Remove DAEMON defines
[platform/upstream/multipath-tools.git] / libmultipath / debug.c
1 /*
2  * Copyright (c) 2005 Christophe Varoqui
3  */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <stdarg.h>
7
8 #include "log_pthread.h"
9 #include <sys/types.h>
10 #include <time.h>
11
12 #include "vector.h"
13 #include "config.h"
14
15 void dlog (int sink, int prio, const char * fmt, ...)
16 {
17         va_list ap;
18         int thres;
19
20         va_start(ap, fmt);
21         thres = (conf) ? conf->verbosity : 0;
22
23         if (prio <= thres) {
24                 if (!sink) {
25                         time_t t = time(NULL);
26                         struct tm *tb = localtime(&t);
27                         char buff[16];
28
29                         strftime(buff, sizeof(buff), "%b %d %H:%M:%S", tb);
30                         buff[sizeof(buff)-1] = '\0';
31
32                         fprintf(stdout, "%s | ", buff);
33                         vfprintf(stdout, fmt, ap);
34                 }
35                 else
36                         log_safe(prio + 3, fmt, ap);
37         }
38         va_end(ap);
39 }