i3
log.h
Go to the documentation of this file.
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * log.c: Logging functions.
8  *
9  */
10 #ifndef I3_LOG_H
11 #define I3_LOG_H
12 
13 #include <stdarg.h>
14 #include <stdbool.h>
15 
16 /* We will include libi3.h which define its own version of LOG, ELOG.
17  * We want *our* version, so we undef the libi3 one. */
18 #if defined(LOG)
19 #undef LOG
20 #endif
21 #if defined(ELOG)
22 #undef ELOG
23 #endif
24 
26 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
27 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
28 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
29 
30 extern char *errorfilename;
31 extern char *shmlogname;
32 extern int shmlog_size;
33 
39 void init_logging(void);
40 
45 void open_logbuffer(void);
46 
51 void close_logbuffer(void);
52 
57 bool get_debug_logging(void);
58 
63 void set_debug_logging(const bool _debug_logging);
64 
71 void set_verbosity(bool _verbose);
72 
78 void debuglog(char *fmt, ...)
79  __attribute__ ((format (printf, 1, 2)));
80 
85 void errorlog(char *fmt, ...)
86  __attribute__ ((format (printf, 1, 2)));
87 
93 void verboselog(char *fmt, ...)
94  __attribute__ ((format (printf, 1, 2)));
95 
101 void purge_zerobyte_logfile(void);
102 
103 #endif