tsocket_bsd: Attempt to increase the SO_SNDBUF if we get EMSGSIZE in sendto()
[Samba.git] / lib / ntdb / test / logging.c
blob2819dd7cad0b04f14888ff0f6bbe9a05259cf01e
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "tap-interface.h"
4 #include "logging.h"
6 unsigned tap_log_messages;
7 const char *log_prefix = "";
8 char *log_last = NULL;
9 bool suppress_logging;
11 union ntdb_attribute tap_log_attr = {
12 .log = { .base = { .attr = NTDB_ATTRIBUTE_LOG },
13 .fn = tap_log_fn }
16 void tap_log_fn(struct ntdb_context *ntdb,
17 enum ntdb_log_level level,
18 enum NTDB_ERROR ecode,
19 const char *message, void *priv)
21 if (suppress_logging)
22 return;
24 diag("ntdb log level %u: %s: %s%s",
25 level, ntdb_errorstr(ecode), log_prefix, message);
26 if (log_last)
27 free(log_last);
28 log_last = strdup(message);
29 tap_log_messages++;