dnscrypt-proxy 1.6.0
[tomato.git] / release / src / router / dnscrypt / src / proxy / logger.h
blob92862749c200a0bcedd18419fd2bb1fb1899e7fb
2 #ifndef __LOGGER_H__
3 #define __LOGGER_H__ 1
5 #ifndef _WIN32
6 # include <syslog.h>
7 #endif
9 #ifndef MAX_LOG_LINE
10 # define MAX_LOG_LINE 1024U
11 #endif
13 #ifndef LOGGER_DELAY_BETWEEN_IDENTICAL_LOG_ENTRIES
14 # define LOGGER_DELAY_BETWEEN_IDENTICAL_LOG_ENTRIES 60
15 #endif
16 #ifndef LOGGER_ALLOWED_BURST_FOR_IDENTICAL_LOG_ENTRIES
17 # define LOGGER_ALLOWED_BURST_FOR_IDENTICAL_LOG_ENTRIES 5U
18 #endif
20 #ifdef DEBUG
21 # define XDEBUG(X) do { X; } while(0)
22 #else
23 # define XDEBUG(X)
24 #endif
26 #ifdef _WIN32
27 # define LOG_EMERG 0
28 # define LOG_ALERT 1
29 # define LOG_CRIT 2
30 # define LOG_ERR 3
31 # define LOG_WARNING 4
32 # define LOG_NOTICE 5
33 # define LOG_INFO 6
34 # define LOG_DEBUG 7
35 #endif
37 struct ProxyContext_;
39 int logger_open_syslog(struct ProxyContext_ * const context);
41 int logger(struct ProxyContext_ * const context,
42 const int crit, const char * const format, ...)
43 __attribute__ ((format(printf, 3, 4)));
45 int logger_noformat(struct ProxyContext_ * const context,
46 const int crit, const char * const msg);
48 int logger_error(struct ProxyContext_ * const context,
49 const char * const msg);
51 void systemd_notify(struct ProxyContext_ * const context,
52 const char * const msg);
54 int logger_close(struct ProxyContext_ * const context);
56 #endif