diff options
author | Jeremy Allison <jra@samba.org> | 2018-03-21 12:40:50 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-03-22 02:15:13 +0100 |
commit | cdde6d93605d15a59e816a35e8e02ca193bf1403 (patch) | |
tree | 2edf4f3d8d6f8cdad60fb011a58bdff7305c16e9 /lib/util/debug.h | |
parent | 8dabcf8948c2e514b489169c34673e093519b583 (diff) | |
download | samba-cdde6d93605d15a59e816a35e8e02ca193bf1403.tar.gz |
lib: debug: Add DBGC_XXX versions of the macros to allow class-specific messages.
https://bugzilla.samba.org/show_bug.cgi?id=13347
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'lib/util/debug.h')
-rw-r--r-- | lib/util/debug.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/util/debug.h b/lib/util/debug.h index 47280da1a78..1b17fad9694 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -217,6 +217,14 @@ extern int *DEBUGLEVEL_CLASS; && (dbgtext("%s: ", __func__)) \ && (dbgtext body) ) +/* Prefix messages with the function name - class specific */ +#define DBGC_PREFIX(dbgc_class, level, body ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely(DEBUGLEVEL_CLASS[ dbgc_class ] >= (level)) \ + && (dbghdrclass(level, dbgc_class, __location__, __func__ )) \ + && (dbgtext("%s: ", __func__)) \ + && (dbgtext body) ) + /* * Debug levels matching RFC 3164 */ @@ -232,12 +240,34 @@ extern int *DEBUGLEVEL_CLASS; #define DBG_INFO(...) DBG_PREFIX(DBGLVL_INFO, (__VA_ARGS__)) #define DBG_DEBUG(...) DBG_PREFIX(DBGLVL_DEBUG, (__VA_ARGS__)) +#define DBGC_ERR(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \ + DBGLVL_ERR, (__VA_ARGS__)) +#define DBGC_WARNING(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \ + DBGLVL_WARNING, (__VA_ARGS__)) +#define DBGC_NOTICE(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \ + DBGLVL_NOTICE, (__VA_ARGS__)) +#define DBGC_INFO(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \ + DBGLVL_INFO, (__VA_ARGS__)) +#define DBGC_DEBUG(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \ + DBGLVL_DEBUG, (__VA_ARGS__)) + #define D_ERR(...) DEBUG(DBGLVL_ERR, (__VA_ARGS__)) #define D_WARNING(...) DEBUG(DBGLVL_WARNING, (__VA_ARGS__)) #define D_NOTICE(...) DEBUG(DBGLVL_NOTICE, (__VA_ARGS__)) #define D_INFO(...) DEBUG(DBGLVL_INFO, (__VA_ARGS__)) #define D_DEBUG(...) DEBUG(DBGLVL_DEBUG, (__VA_ARGS__)) +#define DC_ERR(...) DEBUGC(dbgc_class, \ + DBGLVL_ERR, (__VA_ARGS__)) +#define DC_WARNING(...) DEBUGC(dbgc_class, \ + DBGLVL_WARNING, (__VA_ARGS__)) +#define DC_NOTICE(...) DEBUGC(dbgc_class, \ + DBGLVL_NOTICE, (__VA_ARGS__)) +#define DC_INFO(...) DEBUGC(dbgc_class, \ + DBGLVL_INFO, (__VA_ARGS__)) +#define DC_DEBUG(...) DEBUGC(dbgc_class, \ + DBGLVL_DEBUG, (__VA_ARGS__)) + /* The following definitions come from lib/debug.c */ /** Possible destinations for the debug log (in order of precedence - |