do not compare syslog numbers
The syslog number value might not indicated severity.
#include <syslog.h>
// Verbosity levels
-#define VERBOSITY_DEBUG LOG_DEBUG
-#define VERBOSITY_VERBOSE LOG_INFO
-#define VERBOSITY_QUIET LOG_WARNING
-
+enum {
+ VERBOSITY_DEBUG,
+ VERBOSITY_VERBOSE,
+ VERBOSITY_QUIET
+};
#define log_error(...) \
log_print(LOG_ERR, __VA_ARGS__);
#define log_info(...) \
do { \
- if (gconf->verbosity >= LOG_INFO) \
+ if (gconf->verbosity >= VERBOSITY_VERBOSE) \
log_print(LOG_INFO, __VA_ARGS__); \
} while (0)
#define log_warning(...) \
do { \
- if (gconf->verbosity >= LOG_WARNING) \
+ if (gconf->verbosity >= VERBOSITY_QUIET) \
log_print(LOG_WARNING, __VA_ARGS__); \
} while (0)
#ifdef DEBUG
#define log_debug(...) \
do { \
- if (gconf->verbosity >= LOG_DEBUG) \
+ if (gconf->verbosity >= VERBOSITY_DEBUG) \
log_print(LOG_DEBUG, __VA_ARGS__); \
} while (0)
#else
