X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Flogging.c;h=dfb332474a24b3eb462278685a19da2126f01abe;hp=85bdc064c80a7fe179f848e789dc62d1806f2d15;hb=587982955ca9c61363d6e3004622ee97eda80e4b;hpb=0455668028cfe8f0417037975bc3d7dd742974db;ds=sidebyside diff --git a/ccan/tdb2/test/logging.c b/ccan/tdb2/test/logging.c index 85bdc064..dfb33247 100644 --- a/ccan/tdb2/test/logging.c +++ b/ccan/tdb2/test/logging.c @@ -1,7 +1,5 @@ -#define _GNU_SOURCE #include #include -#include #include #include "logging.h" @@ -15,25 +13,13 @@ union tdb_attribute tap_log_attr = { }; void tap_log_fn(struct tdb_context *tdb, - enum tdb_debug_level level, void *priv, - const char *fmt, ...) + enum tdb_log_level level, void *priv, + const char *message) { - va_list ap; - char *p; - if (suppress_logging) return; - va_start(ap, fmt); - if (vasprintf(&p, fmt, ap) == -1) - abort(); - /* Strip trailing \n: diag adds it. */ - if (p[strlen(p)-1] == '\n') - p[strlen(p)-1] = '\0'; - diag("tdb log level %u: %s%s", level, log_prefix, p); - free(p); - if (level != TDB_DEBUG_TRACE) - tap_log_messages++; - va_end(ap); + diag("tdb log level %u: %s%s", level, log_prefix, message); + tap_log_messages++; }