s4:scripting/python: always treat the highwatermark as opaque (bug #9508)
[Samba/gebeck_regimport.git] / lib / tdb / test / logging.c
blobdfab4868d2568681433e2070398edba196318494
1 #include "logging.h"
2 #include "tap-interface.h"
3 #include <stdarg.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <stdio.h>
8 bool suppress_logging = false;
9 const char *log_prefix = "";
11 /* Turn log messages into tap diag messages. */
12 static void taplog(struct tdb_context *tdb,
13 enum tdb_debug_level level,
14 const char *fmt, ...)
16 va_list ap;
17 char line[200];
19 if (suppress_logging)
20 return;
22 va_start(ap, fmt);
23 vsprintf(line, fmt, ap);
24 va_end(ap);
26 /* Strip trailing \n: diag adds it. */
27 if (line[0] && line[strlen(line)-1] == '\n')
28 diag("%s%.*s", log_prefix, (unsigned)strlen(line)-1, line);
29 else
30 diag("%s%s", log_prefix, line);
33 struct tdb_logging_context taplogctx = { taplog, NULL };