i3
Macros | Functions | Variables
log.h File Reference
#include <stdarg.h>
#include <stdbool.h>
Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOG(fmt,...)   verboselog(fmt, ##__VA_ARGS__)
 

__VA_ARGS__ means: leave out VA_ARGS completely if it is empty, that

is, delete the preceding comma More...
 
#define ELOG(fmt,...)   errorlog("ERROR: " fmt, ##__VA_ARGS__)
 
#define DLOG(fmt,...)   debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
 

Functions

void init_logging (void)
 Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filename()). More...
 
void open_logbuffer (void)
 Opens the logbuffer. More...
 
void close_logbuffer (void)
 Closes the logbuffer. More...
 
bool get_debug_logging (void)
 Checks if debug logging is active. More...
 
void set_debug_logging (const bool _debug_logging)
 Set debug logging. More...
 
void set_verbosity (bool _verbose)
 Set verbosity of i3. More...
 
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 was activated. More...
 
void void errorlog (char *fmt,...) __attribute__((format(printf
 Logs the given message to stdout while prefixing the current time to it. More...
 
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 activated. More...
 
void void void void purge_zerobyte_logfile (void)
 Deletes the unused log files. More...
 

Variables

char * errorfilename
 
char * shmlogname
 
int shmlog_size
 

Macro Definition Documentation

#define DLOG (   fmt,
  ... 
)    debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)

Definition at line 30 of file log.h.

#define ELOG (   fmt,
  ... 
)    errorlog("ERROR: " fmt, ##__VA_ARGS__)

Definition at line 29 of file log.h.

#define LOG (   fmt,
  ... 
)    verboselog(fmt, ##__VA_ARGS__)

__VA_ARGS__ means: leave out VA_ARGS completely if it is empty, that

is, delete the preceding comma

Definition at line 28 of file log.h.

Function Documentation

void close_logbuffer ( void  )

Closes the logbuffer.

Definition at line 172 of file log.c.

References logbuffer, logbuffer_shm, and shmlogname.

Referenced by init_logging(), and open_logbuffer().

void debuglog ( char *  fmt,
  ... 
)

Logs the given message to stdout while prefixing the current time to it, but only if debug logging was activated.

void void errorlog ( char *  fmt,
  ... 
)

Logs the given message to stdout while prefixing the current time to it.

bool get_debug_logging ( void  )

Checks if debug logging is active.

Definition at line 193 of file log.c.

References debug_logging.

Referenced by cmd_debuglog().

void init_logging ( void  )

Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filename()).

Definition at line 81 of file log.c.

References close_logbuffer(), errorfile, errorfilename, get_process_filename(), logbuffer, open_logbuffer(), purge_zerobyte_logfile(), and shmlog_size.

Referenced by cmd_shmlog(), and main().

Here is the call graph for this function:

void open_logbuffer ( void  )

Opens the logbuffer.

Definition at line 106 of file log.c.

References close_logbuffer(), i3_shmlog_header::condvar, logbuffer, logbuffer_shm, logbuffer_size, loglastwrap, logwalk, min(), sasprintf(), shmlog_size, shmlogname, and store_log_markers().

Referenced by init_logging().

Here is the call graph for this function:

void void void void purge_zerobyte_logfile ( void  )

Deletes the unused log files.

Useful if i3 exits immediately, eg. because –get-socketpath was called. We don't care for syscall failures. This function is invoked automatically when exiting.

Definition at line 331 of file log.c.

References errorfilename.

Referenced by cmd_restart(), and init_logging().

void set_debug_logging ( const bool  _debug_logging)

Set debug logging.

Definition at line 201 of file log.c.

References debug_logging.

Referenced by cmd_debuglog(), and main().

void set_verbosity ( bool  _verbose)

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 printed.

Definition at line 185 of file log.c.

References verbose.

Referenced by main().

void void void verboselog ( char *  fmt,
  ... 
)

Logs the given message to stdout while prefixing the current time to it, but only if verbose mode is activated.

Variable Documentation

char* errorfilename

Definition at line 38 of file log.c.

Referenced by init_logging(), parse_file(), purge_zerobyte_logfile(), and run_binding().

int shmlog_size

Definition at line 47 of file log.c.

Referenced by cmd_shmlog(), init_logging(), main(), and open_logbuffer().

char* shmlogname

Definition at line 44 of file log.c.

Referenced by close_logbuffer(), handle_signal(), i3_exit(), open_logbuffer(), and update_shmlog_atom().