db_updater: Put parentheses back
[merlin.git] / mrln_logging.h
blob6406772acd070dbad9bd006b6bae8bf51b511834
1 #ifndef INCLUDE_mrln_logging_h__
2 #define INCLUDE_mrln_logging_h__
4 #include <stdarg.h>
6 #define LOG_EMERG 0 /* system is unusable */
7 #define LOG_ALERT 1 /* action must be taken immediately */
8 #define LOG_CRIT 2 /* critical conditions */
9 #define LOG_ERR 3 /* error conditions */
10 #define LOG_WARNING 4 /* warning conditions */
11 #define LOG_NOTICE 5 /* normal but significant condition */
12 #define LOG_INFO 6 /* informational */
13 #define LOG_DEBUG 7 /* debug-level messages */
15 #ifdef DEBUG_LOGGING
16 # define ldebug(fmt, args...) \
17 log_msg(LOG_DEBUG, "%s:%s():%d: " fmt, __FILE__, __func__, __LINE__, ##args)
18 # define linfo(fmt, args...) \
19 log_msg(LOG_INFO, "%s:%s():%d " fmt, __FILE__, __func__, __LINE__, ##args)
20 # define lmsg(fmt, args...) \
21 log_msg(LOG_NOTICE, "%s:%s():%d " fmt, __FILE__, __func__, __LINE__, ##args)
22 # define lwarn(fmt, args...) \
23 log_msg(LOG_WARNING, "%s:%s():%d " fmt, __FILE__, __func__, __LINE__, ##args)
24 # define lerr(fmt, args...) \
25 log_msg(LOG_ERR, "%s:%s():%d " fmt, __FILE__, __func__, __LINE__, ##args)
26 #else
27 # define ldebug(fmt, args...) log_msg(LOG_DEBUG, fmt, ##args)
28 # define linfo(fmt, args...) log_msg(LOG_INFO, fmt, ##args)
29 # define lmsg(fmt, args...) log_msg(LOG_NOTICE, fmt, ##args)
30 # define lwarn(fmt, args...) log_msg(LOG_WARNING, fmt, ##args)
31 # define lerr(fmt, args...) log_msg(LOG_ERR, fmt, ##args)
32 #endif
34 #define logerr lerr
36 extern int log_init(void);
37 extern void log_deinit(void);
38 extern int log_grok_var(char *var, char *val);
39 extern void log_msg(int severity, const char *fmt, ...)
40 __attribute__((__format__(__printf__, 2, 3)));
41 #endif