File: debug.h

package info (click to toggle)
multipath-tools 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,992 kB
  • sloc: ansic: 63,788; perl: 1,622; makefile: 729; sh: 647; pascal: 150
file content (32 lines) | stat: -rw-r--r-- 633 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef DEBUG_H_INCLUDED
#define DEBUG_H_INCLUDED
void dlog (int prio, const char *fmt, ...)
	__attribute__((format(printf, 2, 3)));


#include <pthread.h>
#include <stdarg.h>

#include "log_pthread.h"

extern int logsink;
extern int libmp_verbosity;

#ifndef MAX_VERBOSITY
#define MAX_VERBOSITY 4
#endif

enum {
	LOGSINK_STDERR_WITH_TIME = 0,
	LOGSINK_STDERR_WITHOUT_TIME = -1,
	LOGSINK_SYSLOG = 1,
};

#define condlog(prio, fmt, args...)					\
	do {								\
		int __p = (prio);					\
									\
		if (__p <= MAX_VERBOSITY && __p <= libmp_verbosity)	\
			dlog(__p, fmt "\n", ##args);			\
	} while (0)
#endif /* DEBUG_H_INCLUDED */