Logging subsystem and helpers.
More...
#include <errno.h>
#include <glib.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
|
| enum | log_mask { DUNST_LOG_NONE
, DUNST_LOG_ALL
, DUNST_LOG_AUTO
} |
| |
Logging subsystem and helpers.
- Copyright
- Copyright 2013-2014 Sascha Kruse
-
Copyright 2014-2026 Dunst contributors
- License
- BSD-3-Clause
Definition in file log.h.
◆ DIE
Value:do { LOG_C(__VA_ARGS__); exit(EXIT_FAILURE); } while (0)
Definition at line 51 of file log.h.
◆ LOG_C
Definition at line 43 of file log.h.
◆ LOG_D
Definition at line 44 of file log.h.
◆ LOG_E
Prefix message with "[<source path>:<function name>:<line number>] ".
- Parameters
-
| format | is either a format string like the first argument of printf() or a string literal. ... are the arguments to above format string. |
This requires -Wno-gnu-zero-variadic-macro-arguments with clang because of token pasting ',' and __VA_ARGS__ being a GNU extension. However, the result is the same with both gcc and clang and since we are compiling with '-std=gnu99', this should be fine.
Definition at line 42 of file log.h.
◆ LOG_I
Definition at line 49 of file log.h.
◆ LOG_M
Definition at line 48 of file log.h.
◆ LOG_W
Definition at line 47 of file log.h.
◆ MSG_FOPEN_FAILURE
| #define MSG_FOPEN_FAILURE |
( |
| path | ) |
|
Value:"Cannot open '%s': %s", path, strerror(errno)
Definition at line 55 of file log.h.
◆ MSG_FOPEN_SUCCESS
| #define MSG_FOPEN_SUCCESS |
( |
| path, |
|
|
| fp ) |
Value:"Opened '%s' (fd: '%d')", path, fileno(fp)
Definition at line 54 of file log.h.
◆ log_mask
Definition at line 57 of file log.h.
◆ dunst_log_init()
| void dunst_log_init |
( |
enum log_mask | mask | ) |
|
Initialise log handling.
Can be called any time.
- Parameters
-
| mask | If we're in testing mode and should suppress all output or show all |
Definition at line 95 of file log.c.
◆ log_set_level()
| void log_set_level |
( |
GLogLevelFlags | level | ) |
|
Set the current loglevel to level
- Parameters
-
| level | The desired log level |
If level is NULL, nothing will be done. If level is an invalid value, nothing will be done.
Definition at line 58 of file log.c.
◆ log_set_level_from_string()
| void log_set_level_from_string |
( |
const char * | level | ) |
|
Set the current loglevel to level
- Parameters
-
| level | The desired log level as a string |
If level is NULL, nothing will be done. If level is an invalid value, nothing will be done.
Definition at line 32 of file log.c.