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 /* We will include libi3.h which define its own version of LOG, ELOG.
15  * We want *our* version, so we undef the libi3 one. */
16 #if defined(LOG)
17 #undef LOG
18 #endif
19 #if defined(ELOG)
20 #undef ELOG
21 #endif
22 #if defined(DLOG)
23 #undef DLOG
24 #endif
27 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
28 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
29 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
30 
31 extern char *errorfilename;
32 extern char *shmlogname;
33 extern int shmlog_size;
34 
40 void init_logging(void);
41 
46 void open_logbuffer(void);
47 
52 void close_logbuffer(void);
53 
58 bool get_debug_logging(void);
59 
64 void set_debug_logging(const bool _debug_logging);
65 
72 void set_verbosity(bool _verbose);
73 
79 void debuglog(char *fmt, ...)
80  __attribute__((format(printf, 1, 2)));
81 
86 void errorlog(char *fmt, ...)
87  __attribute__((format(printf, 1, 2)));
88 
94 void verboselog(char *fmt, ...)
95  __attribute__((format(printf, 1, 2)));
96 
102 void purge_zerobyte_logfile(void);
__attribute__((pure))
Definition: util.c:67
int shmlog_size
Definition: log.c:46
void void void void purge_zerobyte_logfile(void)
Deletes the unused log files.
Definition: log.c:352
bool get_debug_logging(void)
Checks if debug logging is active.
Definition: log.c:203
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 ...
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
Definition: log.c:82
void set_debug_logging(const bool _debug_logging)
Set debug logging.
Definition: log.c:211
void open_logbuffer(void)
Opens the logbuffer.
Definition: log.c:122
char * shmlogname
Definition: log.c:43
void set_verbosity(bool _verbose)
Set verbosity of i3.
Definition: log.c:195
char * errorfilename
Definition: log.c:37
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 close_logbuffer(void)
Closes the logbuffer.
Definition: log.c:181