1
2
3
4
5 #ifndef ZLOG_H
6 #define ZLOG_H 1
7
8 #define zlog(flags,...) zlog_ex(__func__, __LINE__, flags, __VA_ARGS__)
9
10 struct timeval;
11
12 void zlog_set_external_logger(void (*logger)(int, char *, size_t));
13 int zlog_set_fd(int new_fd);
14 int zlog_set_level(int new_value);
15 const char *zlog_get_level_name(int log_level);
16 void zlog_set_launched(void);
17
18 size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len);
19
20 void zlog_ex(const char *function, int line, int flags, const char *fmt, ...)
21 __attribute__ ((format(printf,4,5)));
22
23 #ifdef HAVE_SYSLOG_H
24 extern const int syslog_priorities[];
25 #endif
26
27 enum {
28 ZLOG_DEBUG = 1,
29 ZLOG_NOTICE = 2,
30 ZLOG_WARNING = 3,
31 ZLOG_ERROR = 4,
32 ZLOG_ALERT = 5,
33 };
34
35 #define ZLOG_LEVEL_MASK 7
36
37 #define ZLOG_HAVE_ERRNO 0x100
38
39 #define ZLOG_SYSERROR (ZLOG_ERROR | ZLOG_HAVE_ERRNO)
40
41 #ifdef HAVE_SYSLOG_H
42 #define ZLOG_SYSLOG -2
43 #endif
44
45 #endif