tdb2: more tests, hash collision fixes, attribute support.
[ccan] / ccan / tdb2 / test / logging.c
index 8b057bc662786f5b68761765480ded80da32cb2d..7fd3b1f2345e209b347c7a6e5fc380d38d61ec81 100644 (file)
@@ -7,6 +7,11 @@
 
 unsigned tap_log_messages;
 
+union tdb_attribute tap_log_attr = {
+       .log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
+                .log_fn = tap_log_fn }
+};
+
 void tap_log_fn(struct tdb_context *tdb,
                enum tdb_debug_level level, void *priv,
                const char *fmt, ...)
@@ -19,7 +24,8 @@ void tap_log_fn(struct tdb_context *tdb,
                abort();
        diag("tdb log level %u: %s", level, p);
        free(p);
-       tap_log_messages++;
+       if (level != TDB_DEBUG_TRACE)
+               tap_log_messages++;
        va_end(ap);
 }