]> git.sur5r.net Git - i3/i3/blob - include/log.h
loglevel bitmasks needs to be larger because we got more than 32 files
[i3/i3] / include / log.h
1 /*
2  * vim:ts=8:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  *
6  * © 2009-2010 Michael Stapelberg and contributors
7  *
8  * See file LICENSE for license information.
9  *
10  */
11 #ifndef _LOG_H
12 #define _LOG_H
13
14 #include <stdarg.h>
15 #include <stdbool.h>
16
17 /** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
18    is, delete the preceding comma */
19 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
20 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
21 #define DLOG(fmt, ...) debuglog(LOGLEVEL, "%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
22
23 extern char *loglevels[];
24
25 /**
26  * Enables the given loglevel.
27  *
28  */
29 void add_loglevel(const char *level);
30
31 /**
32  * Set verbosity of i3. If verbose is set to true, informative messages will
33  * be printed to stdout. If verbose is set to false, only errors will be
34  * printed.
35  *
36  */
37 void set_verbosity(bool _verbose);
38
39 /**
40  * Logs the given message to stdout while prefixing the current time to it,
41  * but only if the corresponding debug loglevel was activated.
42  *
43  */
44 void debuglog(uint64_t lev, char *fmt, ...);
45
46 /**
47  * Logs the given message to stdout while prefixing the current time to it.
48  *
49  */
50 void errorlog(char *fmt, ...);
51
52 /**
53  * Logs the given message to stdout while prefixing the current time to it,
54  * but only if verbose mode is activated.
55  *
56  */
57 void verboselog(char *fmt, ...);
58
59 /**
60  * Logs the given message to stdout while prefixing the current time to it.
61  * This is to be called by LOG() which includes filename/linenumber
62  *
63  */
64 void slog(char *fmt, va_list args);
65
66 #endif