1 #ifndef __TINC_LOGGER_H__
2 #define __TINC_LOGGER_H__
5 DEBUG_NOTHING = 0, /* Quiet mode, only show starting/stopping of the daemon */
7 DEBUG_CONNECTIONS = 1, /* Show (dis)connects of other tinc daemons via TCP */
8 DEBUG_ERROR = 2, /* Show error messages received from other hosts */
9 DEBUG_STATUS = 2, /* Show status messages received from other hosts */
10 DEBUG_PROTOCOL = 3, /* Show the requests that are sent/received */
11 DEBUG_META = 4, /* Show contents of every request that is sent/received */
12 DEBUG_TRAFFIC = 5, /* Show network traffic information */
13 DEBUG_PACKET = 6, /* Show contents of each packet that is being sent/received */
14 DEBUG_SCARY_THINGS = 10 /* You have been warned */
17 typedef enum logmode_t {
25 #define LOG_EMERG EVENTLOG_ERROR_TYPE
26 #define LOG_ALERT EVENTLOG_ERROR_TYPE
27 #define LOG_CRIT EVENTLOG_ERROR_TYPE
28 #define LOG_ERR EVENTLOG_ERROR_TYPE
29 #define LOG_WARNING EVENTLOG_WARNING_TYPE
30 #define LOG_NOTICE EVENTLOG_INFORMATION_TYPE
31 #define LOG_INFO EVENTLOG_INFORMATION_TYPE
32 #define LOG_DEBUG EVENTLOG_INFORMATION_TYPE
48 extern debug_t debug_level;
49 extern void openlogger(const char *, logmode_t);
50 extern void reopenlogger(void);
51 extern void logger(int, const char *, ...) __attribute__ ((__format__(printf, 2, 3)));
52 extern void closelogger(void);
54 #define ifdebug(l) if(debug_level >= DEBUG_##l)
56 #endif /* __TINC_LOGGER_H__ */