Implement logging to a SHM ringbuffer

This feature is automatically enabled when running a debug version of i3.
The logfile will use 1% of your physical RAM size, but at max 25 MiB.
This commit is contained in:
Michael Stapelberg
2011-12-09 22:27:35 +00:00
parent 4cd5bf94cf
commit e65ee63763
3 changed files with 146 additions and 23 deletions

View File

@ -21,6 +21,8 @@
extern char *loglevels[];
extern char *errorfilename;
extern char *shmlogname;
extern int shmlog_size;
/**
* Initializes logging by creating an error logfile in /tmp (or
@ -35,6 +37,13 @@ void init_logging();
*/
void add_loglevel(const char *level);
/**
* Returns the offsets for the next write and for the last wrap.
* Necessary to print the i3 SHM log in the correct order.
*
*/
void get_log_markers(int *offset_next_write, int *offset_last_wrap, int *size);
/**
* Set verbosity of i3. If verbose is set to true, informative messages will
* be printed to stdout. If verbose is set to false, only errors will be