Fix warnings found by GCC 4.9.
[tinc] / src / logger.h
1 #ifndef __TINC_LOGGER_H__
2 #define __TINC_LOGGER_H__
3
4 typedef enum debug_t {
5         DEBUG_NOTHING = 0,                      /* Quiet mode, only show starting/stopping of the daemon */
6         DEBUG_ALWAYS = 0,
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 */
15 } debug_t;
16
17 typedef enum logmode_t {
18         LOGMODE_NULL,
19         LOGMODE_STDERR,
20         LOGMODE_FILE,
21         LOGMODE_SYSLOG
22 } logmode_t;
23
24 #ifdef HAVE_MINGW
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
33 #else
34 #ifndef HAVE_SYSLOG_H
35 enum {
36         LOG_EMERG,
37         LOG_ALERT,
38         LOG_CRIT,
39         LOG_ERR,
40         LOG_WARNING,
41         LOG_NOTICE,
42         LOG_INFO,
43         LOG_DEBUG,
44 };
45 #endif
46 #endif
47
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);
53
54 #define ifdebug(l) if(debug_level >= DEBUG_##l)
55
56 #endif /* __TINC_LOGGER_H__ */