1 /* copyright 2013 Sascha Kruse and contributors (see LICENSE for licensing information) */
2 
3 #include <glib.h>
4 #include <stdbool.h>
5 #include <stdlib.h>
6 
7 #ifndef DUNST_LOG_H
8 #define DUNST_LOG_H
9 
10 #define LOG_E g_error
11 #define LOG_C g_critical
12 #define LOG_W g_warning
13 #define LOG_M g_message
14 #define LOG_I g_info
15 #define LOG_D g_debug
16 
17 #define DIE(...) do { LOG_C(__VA_ARGS__); exit(EXIT_FAILURE); } while (0)
18 
19 /**
20  * Set the current loglevel to `level`
21  *
22  * @param level The desired log level
23  *
24  * If `level` is `NULL`, nothing will be done.
25  * If `level` is an invalid value, nothing will be done.
26  */
27 void log_set_level(GLogLevelFlags level);
28 
29 /**
30  * Set the current loglevel to `level`
31  *
32  * @param level The desired log level as a string
33  *
34  * If `level` is `NULL`, nothing will be done.
35  * If `level` is an invalid value, nothing will be done.
36  */
37 void log_set_level_from_string(const char* level);
38 
39 /**
40  * Initialise log handling. Can be called any time.
41  *
42  * @param testing If we're in testing mode and should
43  *                suppress all output
44  */
45 void dunst_log_init(bool testing);
46 
47 #endif
48 /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
49