debug: track current debug message class
[metze/samba-autobuild/.git] / lib / util / debug.c
index cb7d80e7c3a87ef8325dda8181efade1fa9fd0f1..38bfe7b9b4a2aea4968bd439d0ec740d15cd4b65 100644 (file)
@@ -161,6 +161,7 @@ static size_t debug_num_classes = 0;
 static struct debug_class *dbgc_config = debug_class_list_initial;
 
 static int current_msg_level = 0;
+static int current_msg_class = 0;
 
 #if defined(WITH_SYSLOG) || defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
 static int debug_level_to_priority(int level)
@@ -1401,6 +1402,9 @@ bool dbghdrclass(int level, int cls, const char *location, const char *func)
        /* Set current_msg_level. */
        current_msg_level = level;
 
+       /* Set current message class */
+       current_msg_class = cls;
+
        /* Don't print a header if we're logging to stdout. */
        if ( state.logtype != DEBUG_FILE ) {
                return( true );