i3
log.h
Go to the documentation of this file.
1/*
2 * vim:ts=4:sw=4:expandtab
3 *
4 * i3 - an improved dynamic tiling window manager
5 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6 *
7 * log.c: Logging functions.
8 *
9 */
10#pragma once
11
12#include <config.h>
13
14#include <stdarg.h>
15#include <stdbool.h>
16
17/* We will include libi3.h which define its own version of LOG, ELOG.
18 * We want *our* version, so we undef the libi3 one. */
19#if defined(LOG)
20#undef LOG
21#endif
22#if defined(ELOG)
23#undef ELOG
24#endif
25#if defined(DLOG)
26#undef DLOG
27#endif
30#define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
31#define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
32#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
33
34extern char *errorfilename;
35extern char *shmlogname;
36extern int shmlog_size;
37
43void init_logging(void);
44
49void open_logbuffer(void);
50
55void close_logbuffer(void);
56
61bool get_debug_logging(void);
62
67void set_debug_logging(const bool _debug_logging);
68
75void set_verbosity(bool _verbose);
76
82void debuglog(char *fmt, ...)
83 __attribute__((format(printf, 1, 2)));
84
89void errorlog(char *fmt, ...)
90 __attribute__((format(printf, 1, 2)));
91
97void verboselog(char *fmt, ...)
98 __attribute__((format(printf, 1, 2)));
99
105void purge_zerobyte_logfile(void);
__attribute__((pure))
Definition: util.c:64
int shmlog_size
Definition: log.c:49
void void void void purge_zerobyte_logfile(void)
Deletes the unused log files.
Definition: log.c:355
bool get_debug_logging(void)
Checks if debug logging is active.
Definition: log.c:206
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 ...
void init_logging(void)
Initializes logging by creating an error logfile in /tmp (or XDG_RUNTIME_DIR, see get_process_filenam...
Definition: log.c:85
void set_debug_logging(const bool _debug_logging)
Set debug logging.
Definition: log.c:214
void open_logbuffer(void)
Opens the logbuffer.
Definition: log.c:125
char * shmlogname
Definition: log.c:46
void set_verbosity(bool _verbose)
Set verbosity of i3.
Definition: log.c:198
char * errorfilename
Definition: log.c:40
void void errorlog(char *fmt,...) __attribute__((format(printf
Logs the given message to stdout while prefixing the current time to it.
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...
void close_logbuffer(void)
Closes the logbuffer.
Definition: log.c:184