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 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * log.c: Logging functions.
8  *
9  */
10 #pragma once
11 
12 #include <config.h>
13 
14 #include <stdarg.h>
15 #include <stdbool.h>
16 
17 /* We will include libi3.h which define its own version of LOG, ELOG.
18  * We want *our* version, so we undef the libi3 one. */
19 #if defined(LOG)
20 #undef LOG
21 #endif
22 #if defined(ELOG)
23 #undef ELOG
24 #endif
25 #if defined(DLOG)
26 #undef DLOG
27 #endif
28 
30 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
31 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
32 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
33 
34 extern char *errorfilename;
35 extern char *shmlogname;
36 extern int shmlog_size;
37 
43 void init_logging(void);
44 
49 void open_logbuffer(void);
50 
55 void close_logbuffer(void);
56 
61 bool get_debug_logging(void);
62 
67 void set_debug_logging(const bool _debug_logging);
68 
75 void set_verbosity(bool _verbose);
76 
82 void debuglog(char *fmt, ...)
83  __attribute__((format(printf, 1, 2)));
84 
89 void errorlog(char *fmt, ...)
90  __attribute__((format(printf, 1, 2)));
91 
97 void verboselog(char *fmt, ...)
98  __attribute__((format(printf, 1, 2)));
99 
105 void purge_zerobyte_logfile(void);
void void errorlog(char *fmt,...) __attribute__((format(printf
Logs the given message to stdout while prefixing the current time to it.
void debuglog(char *fmt,...) __attribute__((format(printf
Logs the given message to stdout while prefixing the current time to it, but only if debug logging wa...
void void void void purge_zerobyte_logfile(void)
Deletes the unused log files.
Definition: log.c:355
void close_logbuffer(void)
Closes the logbuffer.
Definition: log.c:184
void void void verboselog(char *fmt,...) __attribute__((format(printf
Logs the given message to stdout while prefixing the current time to it, but only if verbose mode is ...
char * errorfilename
Definition: log.c:40
void set_verbosity(bool _verbose)
Set verbosity of i3.
Definition: log.c:198
struct reservedpx __attribute__
void set_debug_logging(const bool _debug_logging)
Set debug logging.
Definition: log.c:214
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
Definition: log.c:85
bool get_debug_logging(void)
Checks if debug logging is active.
Definition: log.c:206
char * shmlogname
Definition: log.c:46
void open_logbuffer(void)
Opens the logbuffer.
Definition: log.c:125
int shmlog_size
Definition: log.c:49