]> git.sur5r.net Git - i3/i3/blob - include/log.h
add i3-nagbar. tells you about config file errors (for example)
[i3/i3] / include / log.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  *
6  * © 2009-2011 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 extern char *errorfilename;
25
26 /**
27  * Initializes logging by creating an error logfile in /tmp (or
28  * XDG_RUNTIME_DIR, see get_process_filename()).
29  *
30  */
31 void init_logging();
32
33 /**
34  * Enables the given loglevel.
35  *
36  */
37 void add_loglevel(const char *level);
38
39 /**
40  * Set verbosity of i3. If verbose is set to true, informative messages will
41  * be printed to stdout. If verbose is set to false, only errors will be
42  * printed.
43  *
44  */
45 void set_verbosity(bool _verbose);
46
47 /**
48  * Logs the given message to stdout while prefixing the current time to it,
49  * but only if the corresponding debug loglevel was activated.
50  *
51  */
52 void debuglog(uint64_t lev, char *fmt, ...);
53
54 /**
55  * Logs the given message to stdout while prefixing the current time to it.
56  *
57  */
58 void errorlog(char *fmt, ...);
59
60 /**
61  * Logs the given message to stdout while prefixing the current time to it,
62  * but only if verbose mode is activated.
63  *
64  */
65 void verboselog(char *fmt, ...);
66
67 /**
68  * Logs the given message to stdout while prefixing the current time to it.
69  * This is to be called by LOG() which includes filename/linenumber
70  *
71  */
72 void slog(char *fmt, va_list args);
73
74 #endif