diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2016-01-11 11:06:22 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-02-23 12:26:21 +0100 |
commit | 22bbd95a48d21452fa5bb1a96b43334503bf8132 (patch) | |
tree | 844b4c2a8bfe8e1e8777b6637fc131d77885bd55 | |
parent | 2a44a8c6683cfea218ee5329bcfad953dfeb6746 (diff) | |
download | sssd-22bbd95a48d21452fa5bb1a96b43334503bf8132.tar.gz sssd-22bbd95a48d21452fa5bb1a96b43334503bf8132.tar.xz sssd-22bbd95a48d21452fa5bb1a96b43334503bf8132.zip |
UTIL: Provide varargs version of debug_fn
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
-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, |