source: vendor/current/lib/tdb/test/logging.c

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 716 bytes
Line 
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>
7
8bool suppress_logging = false;
9const char *log_prefix = "";
10
11/* Turn log messages into tap diag messages. */
12static void taplog(struct tdb_context *tdb,
13 enum tdb_debug_level level,
14 const char *fmt, ...)
15{
16 va_list ap;
17 char line[200];
18
19 if (suppress_logging)
20 return;
21
22 va_start(ap, fmt);
23 vsprintf(line, fmt, ap);
24 va_end(ap);
25
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);
31}
32
33struct tdb_logging_context taplogctx = { taplog, NULL };
Note: See TracBrowser for help on using the repository browser.