tdb2: rearrange log function to put data arg at the end.
[ccan] / ccan / tdb2 / test / logging.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <ccan/tap/tap.h>
4 #include "logging.h"
5
6 unsigned tap_log_messages;
7 const char *log_prefix = "";
8 bool suppress_logging;
9
10 union tdb_attribute tap_log_attr = {
11         .log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
12                  .fn = tap_log_fn }
13 };
14
15 void tap_log_fn(struct tdb_context *tdb,
16                 enum tdb_log_level level,
17                 const char *message, void *priv)
18 {
19         if (suppress_logging)
20                 return;
21
22         diag("tdb log level %u: %s%s", level, log_prefix, message);
23         tap_log_messages++;
24 }
25