i3
|
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
#include "util.h"
#include "log.h"
#include "i3.h"
#include "libi3.h"
#include "shmlog.h"
#include "loglevels.h"
Go to the source code of this file.
Functions | |
static void | store_log_markers (void) |
void | init_logging (void) |
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filename()). | |
void | set_verbosity (bool _verbose) |
Set verbosity of i3. | |
void | add_loglevel (const char *level) |
Enables the given loglevel. | |
static void | vlog (const bool print, const char *fmt, va_list args) |
void | verboselog (char *fmt,...) |
Logs the given message to stdout while prefixing the current time to it, but only if verbose mode is activated. | |
void | errorlog (char *fmt,...) |
Logs the given message to stdout while prefixing the current time to it. | |
void | debuglog (uint64_t lev, char *fmt,...) |
Logs the given message to stdout while prefixing the current time to it, but only if the corresponding debug loglevel was activated. | |
Variables | |
static uint64_t | loglevel = 0 |
static bool | verbose = false |
static FILE * | errorfile |
char * | errorfilename |
char * | shmlogname = "" |
int | shmlog_size = 0 |
static char * | logbuffer |
static char * | logwalk |
static char * | loglastwrap |
static int | logbuffer_size |
static int | logbuffer_shm |
void add_loglevel | ( | const char * | level | ) |
void debuglog | ( | uint64_t | lev, |
char * | fmt, | ||
... | |||
) |
void errorlog | ( | char * | fmt, |
... | |||
) |
void init_logging | ( | void | ) |
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filename()).
Definition at line 77 of file log.c.
References ELOG, errorfile, errorfilename, get_process_filename(), logbuffer, logbuffer_shm, logbuffer_size, loglastwrap, logwalk, min(), sasprintf(), shmlog_size, shmlogname, and store_log_markers().
Referenced by main().
void set_verbosity | ( | bool | _verbose | ) |
static void store_log_markers | ( | void | ) | [static] |
Definition at line 62 of file log.c.
References logbuffer, logbuffer_size, loglastwrap, logwalk, i3_shmlog_header::offset_last_wrap, i3_shmlog_header::offset_next_write, and i3_shmlog_header::size.
Referenced by init_logging(), and vlog().
void verboselog | ( | char * | fmt, |
... | |||
) |
static void vlog | ( | const bool | print, |
const char * | fmt, | ||
va_list | args | ||
) | [static] |
Definition at line 167 of file log.c.
References logbuffer, logbuffer_size, loglastwrap, logwalk, and store_log_markers().
Referenced by debuglog(), errorlog(), and verboselog().
FILE* errorfile [static] |
Definition at line 33 of file log.c.
Referenced by errorlog(), and init_logging().
char* errorfilename |
Definition at line 34 of file log.c.
Referenced by init_logging(), and start_configerror_nagbar().
char* logbuffer [static] |
Definition at line 45 of file log.c.
Referenced by debuglog(), init_logging(), store_log_markers(), verboselog(), and vlog().
int logbuffer_shm [static] |
Definition at line 54 of file log.c.
Referenced by init_logging().
int logbuffer_size [static] |
Definition at line 52 of file log.c.
Referenced by init_logging(), store_log_markers(), and vlog().
char* loglastwrap [static] |
Definition at line 50 of file log.c.
Referenced by init_logging(), store_log_markers(), and vlog().
uint64_t loglevel = 0 [static] |
Definition at line 31 of file log.c.
Referenced by add_loglevel(), and debuglog().
char* logwalk [static] |
Definition at line 47 of file log.c.
Referenced by init_logging(), store_log_markers(), and vlog().
int shmlog_size = 0 |
Definition at line 43 of file log.c.
Referenced by init_logging(), and main().
char* shmlogname = "" |
Definition at line 40 of file log.c.
Referenced by handle_signal(), i3_exit(), init_logging(), and x_set_i3_atoms().
bool verbose = false [static] |
Definition at line 32 of file log.c.
Referenced by set_verbosity(), and verboselog().