debug: Add definitions and macros for log levels
authorChristof Schmitt <cs@samba.org>
Fri, 5 Jun 2015 21:45:22 +0000 (14:45 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 10 Jun 2015 23:45:21 +0000 (01:45 +0200)
This provides some convenience macros to use consistent log levels for
messages with different severities.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/debug.h

index 379572fed81db5325b0b08b21dc444ba6cc9124b..8d8f43d417f3985b646f4cf96ea8adb4f98dccff 100644 (file)
@@ -206,6 +206,21 @@ extern int  *DEBUGLEVEL_CLASS;
 #define DEBUGSEP(level)\
        DEBUG((level),("===============================================================\n"))
 
+/*
+ * Debug levels matching RFC 3164
+ */
+#define DBGLVL_ERR      0      /* error conditions */
+#define DBGLVL_WARNING  1      /* warning conditions */
+#define DBGLVL_NOTICE   3      /* normal, but significant, condition */
+#define DBGLVL_INFO     5      /* informational message */
+#define DBGLVL_DEBUG   10      /* debug-level message */
+
+#define DBG_ERR(...)           DEBUG(DBGLVL_ERR,       (__VA_ARGS__))
+#define DBG_WARNING(...)       DEBUG(DBGLVL_WARNING,   (__VA_ARGS__))
+#define DBG_NOTICE(...)        DEBUG(DBGLVL_NOTICE,    (__VA_ARGS__))
+#define DBG_INFO(...)          DEBUG(DBGLVL_INFO,      (__VA_ARGS__))
+#define DBG_DEBUG(...)         DEBUG(DBGLVL_DEBUG,     (__VA_ARGS__))
+
 /* The following definitions come from lib/debug.c  */
 
 /** Possible destinations for the debug log (in order of precedence -