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-2011 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * log.c: Logging functions.
8  *
9  */
10 #pragma once
11 
12 #include <stdarg.h>
13 #include <stdbool.h>
14 
15 /* We will include libi3.h which define its own version of LOG, ELOG.
16  * We want *our* version, so we undef the libi3 one. */
17 #if defined(LOG)
18 #undef LOG
19 #endif
20 #if defined(ELOG)
21 #undef ELOG
22 #endif
23 #if defined(DLOG)
24 #undef DLOG
25 #endif
26 
28 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
29 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
30 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
31 
32 extern char *errorfilename;
33 extern char *shmlogname;
34 extern int shmlog_size;
35 
41 void init_logging(void);
42 
47 void open_logbuffer(void);
48 
53 void close_logbuffer(void);
54 
59 bool get_debug_logging(void);
60 
65 void set_debug_logging(const bool _debug_logging);
66 
73 void set_verbosity(bool _verbose);
74 
80 void debuglog(char *fmt, ...)
81  __attribute__ ((format (printf, 1, 2)));
82 
87 void errorlog(char *fmt, ...)
88  __attribute__ ((format (printf, 1, 2)));
89 
95 void verboselog(char *fmt, ...)
96  __attribute__ ((format (printf, 1, 2)));
97 
103 void purge_zerobyte_logfile(void);
struct reservedpx __attribute__
bool get_debug_logging(void)
Checks if debug logging is active.
Definition: log.c:193
void open_logbuffer(void)
Opens the logbuffer.
Definition: log.c:106
void purge_zerobyte_logfile(void)
Deletes the unused log files.
Definition: log.c:331
char * shmlogname
Definition: log.c:44
void set_verbosity(bool _verbose)
Set verbosity of i3.
Definition: log.c:185
void errorlog(char *fmt,...)
Definition: log.c:295
void close_logbuffer(void)
Closes the logbuffer.
Definition: log.c:172
int shmlog_size
Definition: log.c:47
char * errorfilename
Definition: log.c:38
void verboselog(char *fmt,...)
Definition: log.c:280
void debuglog(char *fmt,...)
Definition: log.c:315
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
Definition: log.c:81
void set_debug_logging(const bool _debug_logging)
Set debug logging.
Definition: log.c:201