[libmultipath] move the async logger in libmultipath
[multipath-tools/.git] / libmultipath / debug.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdarg.h>
4
5 #if DAEMON
6 #include "log_pthread.h"
7 #endif
8
9 #include "config.h"
10
11 void dlog (int sink, int prio, char * fmt, ...)
12 {
13         va_list ap;
14         int thres;
15
16         va_start(ap, fmt);
17         thres = (conf) ? conf->verbosity : 0;
18
19         if (prio <= thres) {
20                 if (!sink) {
21                         vfprintf(stdout, fmt, ap);
22                         fprintf(stdout, "\n");
23                 }
24 #if DAEMON
25                 else
26                         log_safe(prio + 3, fmt, ap);
27 #endif
28         }
29         va_end(ap);
30 }