]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/test/logging.c
tdb2: split expand into functions and test separately.
[ccan] / ccan / tdb2 / test / logging.c
1 #define _GNU_SOURCE
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include <ccan/tap/tap.h>
6 #include "logging.h"
7
8 unsigned tap_log_messages;
9
10 void tap_log_fn(struct tdb_context *tdb,
11                 enum tdb_debug_level level, void *priv,
12                 const char *fmt, ...)
13 {
14         va_list ap;
15         char *p;
16
17         va_start(ap, fmt);
18         if (vasprintf(&p, fmt, ap) == -1)
19                 abort();
20         diag("tdb log level %u: %s", level, p);
21         free(p);
22         tap_log_messages++;
23         va_end(ap);
24 }
25