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