summaryrefslogtreecommitdiff
path: root/lib/util/debug.h
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-03-08 12:21:26 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-03-08 10:14:05 +0100
commitbc66af50ffdffe39ba6c6e3d4dc03e095a89134c (patch)
treeae3dd5158072368add274ddc757d68c2deea6052 /lib/util/debug.h
parent77602d877e755b2672b136704b039d85797fe305 (diff)
downloadsamba-bc66af50ffdffe39ba6c6e3d4dc03e095a89134c.tar.gz
samba-bc66af50ffdffe39ba6c6e3d4dc03e095a89134c.tar.bz2
samba-bc66af50ffdffe39ba6c6e3d4dc03e095a89134c.zip
lib/util: Add a callback facility for debug messages
This will allow dlz_bind9 to put log messages somewhere useful, which may make it easier to debug. Andrew Bartlett
Diffstat (limited to 'lib/util/debug.h')
-rw-r--r--lib/util/debug.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/util/debug.h b/lib/util/debug.h
index c61a2c55be..b3647a3345 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -197,7 +197,7 @@ extern int *DEBUGLEVEL_CLASS;
* for example. This makes it easy to override for debug to stderr on
* the command line, as the smb.conf cannot reset it back to
* file-based logging */
-enum debug_logtype {DEBUG_DEFAULT_STDERR = 0, DEBUG_DEFAULT_STDOUT = 1, DEBUG_FILE = 2, DEBUG_STDOUT = 3, DEBUG_STDERR = 4};
+enum debug_logtype {DEBUG_DEFAULT_STDERR = 0, DEBUG_DEFAULT_STDOUT = 1, DEBUG_FILE = 2, DEBUG_STDOUT = 3, DEBUG_STDERR = 4, DEBUG_CALLBACK = 5};
struct debug_settings {
size_t max_log_size;
@@ -233,6 +233,13 @@ bool debug_get_output_is_stdout(void);
void debug_schedule_reopen_logs(void);
char *debug_list_class_names_and_levels(void);
+typedef void (*debug_callback_fn)(void *private_ptr, int level, const char *msg);
+
+/**
+ Set a callback for all debug messages. Use in dlz_bind9 to push output to the bind logs
+ */
+void debug_set_callback(void *private_ptr, debug_callback_fn fn);
+
/**
log suspicious usage - print comments and backtrace
*/