]> arthur.barton.de Git - netdata.git/blob - src/log.h
ab-debian 0.20170311.01-0ab1, upstream v1.5.0-573-g0fba967b
[netdata.git] / src / log.h
1 #ifndef NETDATA_LOG_H
2 #define NETDATA_LOG_H 1
3
4 #define D_WEB_BUFFER        0x0000000000000001
5 #define D_WEB_CLIENT        0x0000000000000002
6 #define D_LISTENER          0x0000000000000004
7 #define D_WEB_DATA          0x0000000000000008
8 #define D_OPTIONS           0x0000000000000010
9 #define D_PROCNETDEV_LOOP   0x0000000000000020
10 #define D_RRD_STATS         0x0000000000000040
11 #define D_WEB_CLIENT_ACCESS 0x0000000000000080
12 #define D_TC_LOOP           0x0000000000000100
13 #define D_DEFLATE           0x0000000000000200
14 #define D_CONFIG            0x0000000000000400
15 #define D_PLUGINSD          0x0000000000000800
16 #define D_CHILDS            0x0000000000001000
17 #define D_EXIT              0x0000000000002000
18 #define D_CHECKS            0x0000000000004000
19 #define D_NFACCT_LOOP       0x0000000000008000
20 #define D_PROCFILE          0x0000000000010000
21 #define D_RRD_CALLS         0x0000000000020000
22 #define D_DICTIONARY        0x0000000000040000
23 #define D_MEMORY            0x0000000000080000
24 #define D_CGROUP            0x0000000000100000
25 #define D_REGISTRY          0x0000000000200000
26 #define D_VARIABLES         0x0000000000400000
27 #define D_HEALTH            0x0000000000800000
28 #define D_CONNECT_TO        0x0000000001000000
29 #define D_RRDHOST           0x0000000002000000
30 #define D_SYSTEM            0x8000000000000000
31
32 //#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
33 //#define DEBUG 0xffffffff
34 #define DEBUG (0)
35
36 extern uint64_t debug_flags;
37
38 extern const char *program_name;
39
40 extern int stdaccess_fd;
41 extern FILE *stdaccess;
42
43 extern const char *stdaccess_filename;
44 extern const char *stderr_filename;
45 extern const char *stdout_filename;
46
47 extern int access_log_syslog;
48 extern int error_log_syslog;
49 extern int output_log_syslog;
50
51 extern time_t error_log_throttle_period, error_log_throttle_period_backup;
52 extern unsigned long error_log_errors_per_period;
53 extern int error_log_limit(int reset);
54
55 extern void open_all_log_files();
56 extern void reopen_all_log_files();
57
58 #define error_log_limit_reset() do { error_log_throttle_period = error_log_throttle_period_backup; error_log_limit(1); } while(0)
59 #define error_log_limit_unlimited() do { error_log_throttle_period = 0; } while(0)
60
61 #define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
62 #define info(args...)    info_int(__FILE__, __FUNCTION__, __LINE__, ##args)
63 #define infoerr(args...) error_int("INFO", __FILE__, __FUNCTION__, __LINE__, ##args)
64 #define error(args...)   error_int("ERROR", __FILE__, __FUNCTION__, __LINE__, ##args)
65 #define fatal(args...)   fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args)
66
67 extern void log_date(FILE *out);
68 extern void debug_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5);
69 extern void info_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5);
70 extern void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6);
71 extern void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5);
72 extern void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2);
73
74 #endif /* NETDATA_LOG_H */