Daniel Eklöf
36e4435bbf
log: respect the NO_COLOR environment variable
...
http://no-color.org/
Closes #1771
2024-07-18 08:44:30 +02:00
Daniel Eklöf
4f1aaccf81
log: fix syslog not respecting the configured log level
2024-04-05 16:19:24 +02:00
Craig Barnes
e0f3703ae6
util: add streq() function and use in place of strcmp(...) == 0
2024-02-05 12:09:52 +01:00
Daniel Eklöf
b43a41df6a
log: don’t default to syslog enabled
...
Initialize the global ‘do_syslog’ variable to false. This ensures any
log calls done before log_init() has been called (e.g. unit tests)
doesn’t syslog anything.
As a side effect, such log calls no longer open an implicit syslog
file descriptor; this is how this “bug” was found: valgrind detected
an unclosed file descriptor at exit.
Finally, completely disable syslogging if log-level is “none”.
2022-12-02 11:45:10 +01:00
Craig Barnes
ed0ef4bb1d
log: simplify Boolean logic for setting "colorize" var in log_init()
2021-09-15 16:18:05 +01:00
Craig Barnes
5dca0458a0
log: add LOG_CLASS_NONE and use as initializer for log_level
...
This means that logging will be completely disabled until log_init()
has been called, which is useful to prevent log spam when running
UNITTEST{} blocks in debug builds.
Note that this doesn't change the default log level at runtime, which
was already being set to LOG_CLASS_INFO in main.c and client.c.
The new log level is also exposed to the command-line interface as
`--log-level=none`, which allows disabling logging entirely.
2021-06-26 22:15:09 +01:00
Daniel Eklöf
cda55d7de4
log: add va_list versions of log_* functions
2021-05-07 16:52:56 +02:00
Daniel Eklöf
555f751f94
errno: don’t use ‘_errno’ as a variable name; _ are reserved for use as identifiers
2021-02-21 20:33:07 +01:00
Craig Barnes
5437321f97
main: client: factor out some common code for "--log-level" option
2021-02-11 11:08:18 +00:00
Daniel Eklöf
208014d6c9
log: log-level applies to messages logged to stderr too
2021-02-09 20:54:17 +01:00
Craig Barnes
e56136ce11
debug: rename assert() to xassert(), to avoid clashing with <assert.h>
2021-01-16 20:16:00 +00:00
Craig Barnes
22f25a9e4f
Print stack trace on assert() failure or when calling fatal_error()
...
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
2021-01-16 19:56:33 +00:00
Craig Barnes
7eb70a453b
Replace GCC "unused" and "format" attributes with portable macros
2020-08-07 20:42:34 +01:00
Craig Barnes
8541ce10a2
log: simplify _sys_log() function
2020-08-06 23:31:21 +01:00
Craig Barnes
11a1d99da7
Replace non-portable "\e" escape in string literals with "\033"
2020-08-02 23:54:04 +01:00
Daniel Eklöf
cea75625e2
log: always log file:lineno
2020-02-16 14:40:08 +01:00
Daniel Eklöf
82b8853f17
main: add --print-pid=FILE|FD
...
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.
2020-02-05 19:54:16 +01:00
Daniel Eklöf
d7d2aae053
log: log to stderr, not stdout
2020-02-04 18:29:04 +01:00
Daniel Eklöf
a0fcec3a3d
log: caller can control syslog level
2019-12-17 19:07:28 +01:00
Daniel Eklöf
55a23a5b29
log: set syslog facility to LOG_DAEMON when run in server mode
2019-11-20 19:43:31 +01:00
Daniel Eklöf
15b12f45c6
scan-build: fix a couple of minor warnings from a scan-build run
2019-11-05 10:39:36 +01:00
Daniel Eklöf
c03aeb1b4f
log: syslog: tag unused function arguments as unused
2019-07-30 21:50:08 +02:00
Daniel Eklöf
c9138c6d7d
log: log to syslog too
2019-07-30 21:48:14 +02:00
Daniel Eklöf
63fb7a9374
log: don't syslog
2019-06-29 20:48:02 +02:00
Daniel Eklöf
910c540ea9
initial commit: maps an XDG toplevel window
2019-06-12 20:08:54 +02:00