mirror of https://gitee.com/openkylin/libvirt.git
util: switch virLogEatParams to virLogSource
Commit e8fd8757c8
changed 'const char *'
category to virLogSource enum. This changes it in virLogEatParams as
well, thus fixing the build with --disable-debug.
--
Hopefully moving the enum declarations is less ugly than using int.
This commit is contained in:
parent
f81f0f2f1d
commit
a9e3b4f78e
|
@ -25,45 +25,6 @@
|
|||
# include "internal.h"
|
||||
# include "buf.h"
|
||||
|
||||
/*
|
||||
* If configured with --enable-debug=yes then library calls
|
||||
* are printed to stderr for debugging or to an appropriate channel
|
||||
* defined at runtime from the libvirt daemon configuration file
|
||||
*/
|
||||
# ifdef ENABLE_DEBUG
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, __VA_ARGS__)
|
||||
# else
|
||||
/**
|
||||
* virLogEatParams:
|
||||
*
|
||||
* Do nothing but eat parameters.
|
||||
*/
|
||||
static inline void virLogEatParams(const char *unused, ...)
|
||||
{
|
||||
/* Silence gcc */
|
||||
unused = unused;
|
||||
}
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
|
||||
# endif /* !ENABLE_DEBUG */
|
||||
|
||||
# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, __VA_ARGS__)
|
||||
# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, __VA_ARGS__)
|
||||
# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, __VA_ARGS__)
|
||||
|
||||
# define VIR_DEBUG(...) \
|
||||
VIR_DEBUG_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_INFO(...) \
|
||||
VIR_INFO_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_WARN(...) \
|
||||
VIR_WARN_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_ERROR(...) \
|
||||
VIR_ERROR_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
/*
|
||||
* To be made public
|
||||
*/
|
||||
|
@ -93,6 +54,45 @@ typedef enum {
|
|||
VIR_LOG_FROM_LAST,
|
||||
} virLogSource;
|
||||
|
||||
/*
|
||||
* If configured with --enable-debug=yes then library calls
|
||||
* are printed to stderr for debugging or to an appropriate channel
|
||||
* defined at runtime from the libvirt daemon configuration file
|
||||
*/
|
||||
# ifdef ENABLE_DEBUG
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, __VA_ARGS__)
|
||||
# else
|
||||
/**
|
||||
* virLogEatParams:
|
||||
*
|
||||
* Do nothing but eat parameters.
|
||||
*/
|
||||
static inline void virLogEatParams(virLogSource unused, ...)
|
||||
{
|
||||
/* Silence gcc */
|
||||
unused = unused;
|
||||
}
|
||||
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
|
||||
# endif /* !ENABLE_DEBUG */
|
||||
|
||||
# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, __VA_ARGS__)
|
||||
# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, __VA_ARGS__)
|
||||
# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, __VA_ARGS__)
|
||||
|
||||
# define VIR_DEBUG(...) \
|
||||
VIR_DEBUG_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_INFO(...) \
|
||||
VIR_INFO_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_WARN(...) \
|
||||
VIR_WARN_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
# define VIR_ERROR(...) \
|
||||
VIR_ERROR_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* virLogOutputFunc:
|
||||
* @src: the src for the message
|
||||
|
|
Loading…
Reference in New Issue