i3
log.h File Reference
#include <config.h>
#include <libev/ev.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, ...)
 
#define ELOG(fmt, ...)
 
#define DLOG(fmt, ...)
 

Functions

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

Variables

char * errorfilename
 
char * shmlogname
 
int shmlog_size
 
char * current_log_stream_socket_path
 

Macro Definition Documentation

◆ DLOG

#define DLOG ( fmt,
... )
Value:
debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
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...

Definition at line 30 of file log.h.

◆ ELOG

#define ELOG ( fmt,
... )
Value:
errorlog("ERROR: " fmt, ##__VA_ARGS__)
void void errorlog(char *fmt,...) __attribute__((format(printf
Logs the given message to stdout while prefixing the current time to it.

Definition at line 29 of file log.h.

◆ LOG

#define LOG ( fmt,
... )
Value:
verboselog(fmt, ##__VA_ARGS__)
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 ...

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

◆ close_logbuffer()

void close_logbuffer ( void )

Closes the logbuffer.

Definition at line 191 of file log.c.

References logbuffer, logbuffer_shm, and shmlogname.

Referenced by init_logging(), and open_logbuffer().

◆ debuglog()

void debuglog ( char * fmt,
... )

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

◆ errorlog()

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

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

◆ get_debug_logging()

bool get_debug_logging ( void )

Checks if debug logging is active.

Definition at line 213 of file log.c.

References debug_logging.

Referenced by cmd_debuglog(), and i3_restart().

◆ init_logging()

void init_logging ( void )

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

Definition at line 95 of file log.c.

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

Referenced by cmd_shmlog(), and main().

Here is the call graph for this function:

◆ log_new_client()

void log_new_client ( EV_P_ struct ev_io * w,
int revents )

Definition at line 399 of file log.c.

References log_client::fd.

Referenced by main().

◆ open_logbuffer()

void open_logbuffer ( void )

Opens the logbuffer.

Definition at line 136 of file log.c.

References close_logbuffer(), header, logbuffer, logbuffer_shm, logbuffer_size, loglastwrap, logwalk, physical_mem_bytes, sasprintf(), shmlog_size, shmlogname, and store_log_markers().

Referenced by init_logging().

Here is the call graph for this function:

◆ purge_zerobyte_logfile()

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 365 of file log.c.

References errorfilename.

Referenced by cmd_restart(), and init_logging().

◆ set_debug_logging()

void set_debug_logging ( const bool _debug_logging)

Set debug logging.

Definition at line 221 of file log.c.

References debug_logging.

Referenced by cmd_debuglog(), and main().

◆ set_verbosity()

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 205 of file log.c.

References verbose.

Referenced by main().

◆ verboselog()

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

◆ current_log_stream_socket_path

char* current_log_stream_socket_path
extern

Definition at line 390 of file log.c.

Referenced by cmd_restart(), i3_exit(), main(), and x_set_i3_atoms().

◆ errorfilename

char* errorfilename
extern

Definition at line 38 of file log.c.

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

◆ shmlog_size

int shmlog_size
extern

Definition at line 47 of file log.c.

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

◆ shmlogname

char* shmlogname
extern