tdb: improve logging
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 1 Jul 2010 08:33:18 +0000 (18:33 +1000)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 1 Jul 2010 08:33:18 +0000 (18:33 +1000)
When tdb throws an error, we didn't report the name of the tdb; we should.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/util/db_wrap.c

index 7f5240e932891355ca2431b09ef40aa8130f4c8d..9c4f6dd4d7198c35e89f19030aa6eaebba2afeb5 100644 (file)
@@ -48,9 +48,10 @@ static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const ch
 {
        if (level <= TDB_DEBUG_ERROR) {
                va_list ap;
-
+               char newfmt[strlen(tdb_name(tdb)) + 1 + strlen(fmt) + 1];
+               sprintf(newfmt, "%s:%s", tdb_name(tdb), fmt);
                va_start(ap, fmt);
-               do_debug_v(fmt, ap);
+               do_debug_v(newfmt, ap);
                va_end(ap);
        }
 }