From bc66af50ffdffe39ba6c6e3d4dc03e095a89134c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 8 Mar 2012 12:21:26 +1100 Subject: 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 --- lib/util/debug.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/util/debug.h') 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 */ -- cgit