Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / proxy / logger.h
blobefe61a2591ec365357433b637f04eccadfdc58e7
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
12 #ifndef LOG_WRITE_TIMEOUT
13 # define LOG_WRITE_TIMEOUT -1
14 #endif
16 #ifndef LOGGER_DELAY_BETWEEN_IDENTICAL_LOG_ENTRIES
17 # define LOGGER_DELAY_BETWEEN_IDENTICAL_LOG_ENTRIES 1
18 #endif
19 #ifndef LOGGER_ALLOWED_BURST_FOR_IDENTICAL_LOG_ENTRIES
20 # define LOGGER_ALLOWED_BURST_FOR_IDENTICAL_LOG_ENTRIES 10U
21 #endif
23 #ifdef DEBUG
24 # define XDEBUG(X) do { X; } while(0)
25 #else
26 # define XDEBUG(X)
27 #endif
29 #ifdef _WIN32
30 # define LOG_INFO 1
31 # define LOG_WARNING 2
32 # define LOG_ERR 3
33 # define LOG_NOTICE 4
34 # define LOG_DEBUG 5
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 int logger_close(struct ProxyContext_ * const context);
53 #endif