From: Christof Schmitt Date: Fri, 9 Jan 2015 21:00:02 +0000 (-0700) Subject: debug: Add file backend X-Git-Tag: tdb-1.3.5~316 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=978fee84d0f353bef159ef8f7a084961e258d44c;p=thirdparty%2Fsamba.git debug: Add file backend Signed-off-by: Christof Schmitt Reviewed-by: Amitay Isaacs --- diff --git a/lib/util/debug.c b/lib/util/debug.c index 9eba5b823bd..e085aea9e01 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -131,6 +131,13 @@ static int debug_level_to_priority(int level) * all active backends. */ +static void debug_file_log(int msg_level, + const char *msg, const char *msg_no_nl) +{ + check_log_size(); + write(state.fd, msg, strlen(msg)); +} + static struct debug_backend { const char *name; int log_level; @@ -138,6 +145,10 @@ static struct debug_backend { void (*reload)(bool enabled, bool prev_enabled, const char *prog_name); void (*log)(int msg_level, const char *msg, const char *msg_no_nl); } debug_backends[] = { + { + .name = "file", + .log = debug_file_log, + }, }; static struct debug_backend *debug_find_backend(const char *name)