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 #include <ev.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
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, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
31 
32 extern char *errorfilename;
33 extern char *shmlogname;
34 extern int shmlog_size;
36 
42 void init_logging(void);
43 
48 void open_logbuffer(void);
49 
54 void close_logbuffer(void);
55 
60 bool get_debug_logging(void);
61 
66 void set_debug_logging(const bool _debug_logging);
67 
74 void set_verbosity(bool _verbose);
75 
81 void debuglog(char *fmt, ...)
82  __attribute__((format(printf, 1, 2)));
83 
88 void errorlog(char *fmt, ...)
89  __attribute__((format(printf, 1, 2)));
90 
96 void verboselog(char *fmt, ...)
97  __attribute__((format(printf, 1, 2)));
98 
104 void purge_zerobyte_logfile(void);
105 
106 void log_new_client(EV_P_ struct ev_io *w, int revents);
__attribute__((pure))
Definition: util.c:67
int shmlog_size
Definition: log.c:47
void void void void purge_zerobyte_logfile(void)
Deletes the unused log files.
Definition: log.c:354
bool get_debug_logging(void)
Checks if debug logging is active.
Definition: log.c:208
void log_new_client(EV_P_ struct ev_io *w, int revents)
Definition: log.c:385
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:95
void set_debug_logging(const bool _debug_logging)
Set debug logging.
Definition: log.c:216
char * current_log_stream_socket_path
Definition: log.c:376
void open_logbuffer(void)
Opens the logbuffer.
Definition: log.c:135
char * shmlogname
Definition: log.c:44
void set_verbosity(bool _verbose)
Set verbosity of i3.
Definition: log.c:200
char * errorfilename
Definition: log.c:38
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:186