-
Notifications
You must be signed in to change notification settings - Fork 14
/
n2n_log.h
49 lines (33 loc) · 1.13 KB
/
n2n_log.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* n2n_log.h
*
* Created on: Aug 21, 2013
* Author: wolf
*/
#ifndef N2N_LOG_H_
#define N2N_LOG_H_
/* Logging levels */
#define N2N_LOG_ERROR 0
#define N2N_LOG_WARNING 1
#define N2N_LOG_NORMAL 2
#define N2N_LOG_INFO 3
#define N2N_LOG_DEBUG 4
#define TRACE(LOG_LVL) LOG_LVL, __FILE__, __LINE__
#define TRACE_ERROR TRACE(N2N_LOG_ERROR)
#define TRACE_WARNING TRACE(N2N_LOG_WARNING)
#define TRACE_NORMAL TRACE(N2N_LOG_NORMAL)
#define TRACE_INFO TRACE(N2N_LOG_INFO)
#define TRACE_DEBUG TRACE(N2N_LOG_DEBUG)
/* ************************************** */
extern int traceLevel;
#ifndef WIN32
extern int useSyslog;
#endif
void traceEvent(int eventTraceLevel, char *file, int line, char *format, ...);
/* ************************************** */
#define traceError(...) traceEvent(TRACE_ERROR, __VA_ARGS__)
#define traceWarning(...) traceEvent(TRACE_WARNING, __VA_ARGS__)
#define traceNormal(...) traceEvent(TRACE_NORMAL, __VA_ARGS__)
#define traceInfo(...) traceEvent(TRACE_INFO, __VA_ARGS__)
#define traceDebug(...) traceEvent(TRACE_DEBUG, __VA_ARGS__)
#endif /* N2N_LOG_H_ */