5 logger.h -- header file for logger.c
6 Copyright (C) 1998-2005 Ivo Timmermans
7 2000-2017 Guus Sliepen <guus@tinc-vpn.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 typedef enum debug_t {
25 DEBUG_UNSET = -1, /* Used by tinc as the default debug level. */
26 DEBUG_NOTHING = 0, /* Quiet mode, only show starting/stopping of the daemon */
28 DEBUG_CONNECTIONS = 1, /* Show (dis)connects of other tinc daemons via TCP */
29 DEBUG_ERROR = 2, /* Show error messages received from other hosts */
30 DEBUG_STATUS = 2, /* Show status messages received from other hosts */
31 DEBUG_PROTOCOL = 3, /* Show the requests that are sent/received */
32 DEBUG_META = 4, /* Show contents of every request that is sent/received */
33 DEBUG_TRAFFIC = 5, /* Show network traffic information */
34 DEBUG_PACKET = 6, /* Show contents of each packet that is being sent/received */
35 DEBUG_SCARY_THINGS = 10 /* You have been warned */
38 typedef enum logmode_t {
46 #define LOG_EMERG EVENTLOG_ERROR_TYPE
47 #define LOG_ALERT EVENTLOG_ERROR_TYPE
48 #define LOG_CRIT EVENTLOG_ERROR_TYPE
49 #define LOG_ERR EVENTLOG_ERROR_TYPE
50 #define LOG_WARNING EVENTLOG_WARNING_TYPE
51 #define LOG_NOTICE EVENTLOG_INFORMATION_TYPE
52 #define LOG_INFO EVENTLOG_INFORMATION_TYPE
53 #define LOG_DEBUG EVENTLOG_INFORMATION_TYPE
71 extern debug_t debug_level;
72 extern bool logcontrol;
74 extern void openlogger(const char *ident, logmode_t mode);
75 extern void reopenlogger(void);
76 extern void logger(debug_t level, int priority, const char *format, ...) __attribute__((__format__(printf, 3, 4)));
77 extern void closelogger(void);