|
i3
|
#include <config.h>#include "all.h"#include "shmlog.h"#include <ev.h>#include <libgen.h>#include <sys/socket.h>#include <sys/un.h>#include <errno.h>#include <fcntl.h>#include <stdarg.h>#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/mman.h>#include <sys/stat.h>#include <sys/time.h>#include <unistd.h>
Go to the source code of this file.
Data Structures | |
| struct | log_client |
Typedefs | |
| typedef struct log_client | log_client |
Functions | |
| void | log_broadcast_to_clients (const char *message, size_t len) |
| 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 | open_logbuffer (void) |
| Opens the logbuffer. | |
| void | close_logbuffer (void) |
| Closes the logbuffer. | |
| void | set_verbosity (bool _verbose) |
| Set verbosity of i3. | |
| bool | get_debug_logging (void) |
| Checks if debug logging is active. | |
| void | set_debug_logging (const bool _debug_logging) |
| Set debug logging. | |
| static void | vlog (const bool print, const char *fmt, va_list args) |
| void | verboselog (char *fmt,...) |
| void | errorlog (char *fmt,...) |
| void | debuglog (char *fmt,...) |
| void | purge_zerobyte_logfile (void) |
| Deletes the unused log files. | |
| void | log_new_client (EV_P_ struct ev_io *w, int revents) |
Variables | |
| static bool | debug_logging = false |
| static bool | verbose = false |
| static FILE * | errorfile |
| char * | errorfilename |
| char * | shmlogname = "" |
| int | shmlog_size = 0 |
| static char * | logbuffer |
| static char * | logwalk |
| static i3_shmlog_header * | header |
| static char * | loglastwrap |
| static int | logbuffer_size |
| static int | logbuffer_shm |
| static long long | physical_mem_bytes |
| log_clients = TAILQ_HEAD_INITIALIZER(log_clients) | |
| char * | current_log_stream_socket_path = NULL |
| typedef struct log_client log_client |
| void close_logbuffer | ( | void | ) |
Closes the logbuffer.
Definition at line 191 of file log.c.
References close_logbuffer(), logbuffer, logbuffer_shm, and shmlogname.
Referenced by close_logbuffer(), init_logging(), and open_logbuffer().

| void debuglog | ( | char * | fmt, |
| ... ) |
Definition at line 348 of file log.c.
References debug_logging, debuglog(), logbuffer, and vlog().
Referenced by debuglog(), and debuglog().

| void errorlog | ( | char * | fmt, |
| ... ) |
Definition at line 325 of file log.c.
References errorfile, errorlog(), and vlog().
Referenced by errorlog(), and errorlog().

| bool get_debug_logging | ( | void | ) |
Checks if debug logging is active.
Definition at line 213 of file log.c.
References debug_logging, and get_debug_logging().
Referenced by cmd_debuglog(), get_debug_logging(), and i3_restart().

| 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(), init_logging(), logbuffer, open_logbuffer(), physical_mem_bytes, purge_zerobyte_logfile(), and shmlog_size.
Referenced by cmd_shmlog(), init_logging(), and main().

| void log_broadcast_to_clients | ( | const char * | message, |
| size_t | len ) |
Definition at line 422 of file log.c.
References log_client::clients, log_client::fd, log_broadcast_to_clients(), log_clients, TAILQ_END, TAILQ_FIRST, TAILQ_NEXT, TAILQ_REMOVE, and writeall().
Referenced by log_broadcast_to_clients(), and vlog().

| void log_new_client | ( | EV_P_ struct ev_io * | w, |
| int | revents ) |
Definition at line 399 of file log.c.
References log_client::fd, and log_new_client().
Referenced by log_new_client(), main(), and verboselog().

| 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, open_logbuffer(), physical_mem_bytes, sasprintf(), shmlog_size, shmlogname, and store_log_markers().
Referenced by init_logging(), and open_logbuffer().

| 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, and purge_zerobyte_logfile().
Referenced by cmd_restart(), init_logging(), purge_zerobyte_logfile(), and verboselog().

| void set_debug_logging | ( | const bool | _debug_logging | ) |
Set debug logging.
Definition at line 221 of file log.c.
References debug_logging, and set_debug_logging().
Referenced by cmd_debuglog(), main(), and set_debug_logging().

| 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 set_verbosity(), and verbose.
Referenced by main(), and set_verbosity().

|
static |
Definition at line 82 of file log.c.
References header, logbuffer, logbuffer_size, loglastwrap, logwalk, i3_shmlog_header::offset_last_wrap, i3_shmlog_header::offset_next_write, i3_shmlog_header::size, and store_log_markers().
Referenced by open_logbuffer(), store_log_markers(), and vlog().

| void verboselog | ( | char * | fmt, |
| ... ) |
Definition at line 309 of file log.c.
References logbuffer, verbose, verboselog(), and vlog().
Referenced by verboselog(), and verboselog().

|
static |
Definition at line 232 of file log.c.
References header, log_broadcast_to_clients(), logbuffer, logbuffer_size, loglastwrap, logwalk, store_log_markers(), vlog(), and i3_shmlog_header::wrap_count.
Referenced by debuglog(), errorlog(), verboselog(), and vlog().

| char* current_log_stream_socket_path = NULL |
Definition at line 390 of file log.c.
Referenced by cmd_restart(), i3_exit(), main(), and x_set_i3_atoms().
|
static |
Definition at line 35 of file log.c.
Referenced by debuglog(), get_debug_logging(), and set_debug_logging().
|
static |
Definition at line 37 of file log.c.
Referenced by errorlog(), and init_logging().
| char* errorfilename |
Definition at line 38 of file log.c.
Referenced by init_logging(), purge_zerobyte_logfile(), run_binding(), and start_config_error_nagbar().
|
static |
Definition at line 53 of file log.c.
Referenced by open_logbuffer(), store_log_markers(), and vlog().
| log_clients = TAILQ_HEAD_INITIALIZER(log_clients) |
Definition at line 72 of file log.c.
Referenced by log_broadcast_to_clients().
|
static |
Definition at line 49 of file log.c.
Referenced by close_logbuffer(), debuglog(), init_logging(), open_logbuffer(), store_log_markers(), verboselog(), and vlog().
|
static |
Definition at line 60 of file log.c.
Referenced by close_logbuffer(), and open_logbuffer().
|
static |
Definition at line 58 of file log.c.
Referenced by open_logbuffer(), store_log_markers(), and vlog().
|
static |
Definition at line 56 of file log.c.
Referenced by open_logbuffer(), store_log_markers(), and vlog().
|
static |
Definition at line 51 of file log.c.
Referenced by open_logbuffer(), store_log_markers(), and vlog().
|
static |
Definition at line 62 of file log.c.
Referenced by init_logging(), and open_logbuffer().
| int shmlog_size = 0 |
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_core_signal(), i3_exit(), open_logbuffer(), and update_shmlog_atom().
|
static |
Definition at line 36 of file log.c.
Referenced by set_verbosity(), and verboselog().