summaryrefslogtreecommitdiff
path: root/source4/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/util')
-rw-r--r--source4/lib/util/debug.c15
-rw-r--r--source4/lib/util/debug.h9
2 files changed, 17 insertions, 7 deletions
diff --git a/source4/lib/util/debug.c b/source4/lib/util/debug.c
index 00dcbfc8bd..b6edb908c7 100644
--- a/source4/lib/util/debug.c
+++ b/source4/lib/util/debug.c
@@ -31,7 +31,9 @@
/**
* this global variable determines what messages are printed
*/
-_PUBLIC_ int DEBUGLEVEL;
+int _debug_level = 0;
+_PUBLIC_ int *debug_level = &_debug_level;
+int *DEBUGLEVEL_CLASS = NULL; /* For samba 3 */
/* the registered mutex handlers */
static struct {
@@ -89,12 +91,19 @@ static void log_timestring(int level, const char *location, const char *func)
the backend for debug messages. Note that the DEBUG() macro has already
ensured that the log level has been met before this is called
*/
-_PUBLIC_ void do_debug_header(int level, const char *location, const char *func)
+_PUBLIC_ void dbghdr(int level, const char *location, const char *func)
{
log_timestring(level, location, func);
log_task_id();
}
+
+_PUBLIC_ void dbghdrclass(int level, int class, const char *location, const char *func)
+{
+ /* Simple wrapper, Samba 4 doesn't do debug classes */
+ dbghdr(level, location, func);
+}
+
/**
the backend for debug messages. Note that the DEBUG() macro has already
ensured that the log level has been met before this is called
@@ -102,7 +111,7 @@ _PUBLIC_ void do_debug_header(int level, const char *location, const char *func)
@note You should never have to call this function directly. Call the DEBUG()
macro instead.
*/
-_PUBLIC_ void do_debug(const char *format, ...)
+_PUBLIC_ void dbgtext(const char *format, ...)
{
va_list ap;
char *s = NULL;
diff --git a/source4/lib/util/debug.h b/source4/lib/util/debug.h
index 605628174a..8f4fa2a8fc 100644
--- a/source4/lib/util/debug.h
+++ b/source4/lib/util/debug.h
@@ -39,6 +39,7 @@ struct debug_ops {
void (*log_task_id)(int fd);
};
+#define DEBUGLEVEL *debug_level
extern int DEBUGLEVEL;
#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL)))
@@ -48,9 +49,9 @@ extern int DEBUGLEVEL;
if (DEBUGLVL(level)) { \
void* _debug_ctx=NULL; \
if (header) { \
- do_debug_header(level, __location__, __FUNCTION__); \
+ dbghdr(level, __location__, __FUNCTION__); \
} \
- do_debug body; \
+ dbgtext body; \
talloc_free(_debug_ctx); \
} \
} while (0)
@@ -77,7 +78,7 @@ enum debug_logtype {DEBUG_STDOUT = 0, DEBUG_FILE = 1, DEBUG_STDERR = 2};
the backend for debug messages. Note that the DEBUG() macro has already
ensured that the log level has been met before this is called
*/
-_PUBLIC_ void do_debug_header(int level, const char *location, const char *func);
+_PUBLIC_ void dbghdr(int level, const char *location, const char *func);
/**
reopen the log file (usually called because the log file name might have changed)
@@ -125,4 +126,4 @@ _PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops);
@note You should never have to call this function directly. Call the DEBUG()
macro instead.
*/
-_PUBLIC_ void do_debug(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
+_PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2);