diff options
-rw-r--r-- | src/util/debug.c | 29 | ||||
-rw-r--r-- | src/util/util.h | 6 |
2 files changed, 25 insertions, 10 deletions
diff --git a/src/util/debug.c b/src/util/debug.c index c0a7732e9..3dcfbf008 100644 --- a/src/util/debug.c +++ b/src/util/debug.c @@ -206,13 +206,13 @@ journal_done: } #endif /* WiTH_JOURNALD */ -void sss_debug_fn(const char *file, - long line, - const char *function, - int level, - const char *format, ...) +void sss_vdebug_fn(const char *file, + long line, + const char *function, + int level, + const char *format, + va_list ap) { - va_list ap; struct timeval tv; struct tm *tm; char datetime[20]; @@ -230,10 +230,8 @@ void sss_debug_fn(const char *file, * can also provide extra structuring data to make it more easily * searchable. */ - va_start(ap, format); va_copy(ap_fallback, ap); ret = journal_send(file, line, function, level, format, ap); - va_end(ap); if (ret != EOK) { /* Emergency fallback, send to STDERR */ debug_vprintf(format, ap_fallback); @@ -266,12 +264,23 @@ void sss_debug_fn(const char *file, debug_prg_name, function, level); } - va_start(ap, format); debug_vprintf(format, ap); - va_end(ap); debug_fflush(); } +void sss_debug_fn(const char *file, + long line, + const char *function, + int level, + const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + sss_vdebug_fn(file, line, function, level, format, ap); + va_end(ap); +} + void ldb_debug_messages(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) { diff --git a/src/util/util.h b/src/util/util.h index 662d786ad..5df86b4cb 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -77,6 +77,12 @@ extern int debug_microseconds; extern int debug_to_file; extern int debug_to_stderr; extern const char *debug_log_file; +void sss_vdebug_fn(const char *file, + long line, + const char *function, + int level, + const char *format, + va_list ap); void sss_debug_fn(const char *file, long line, const char *function, |