mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
logging/trivial: add code comment about logging "<level> [timestamp]"
This commit is contained in:
parent
3fd28a11d4
commit
226848ea62
|
@ -707,6 +707,20 @@ _nm_log_impl(const char *file,
|
|||
|
||||
msg = nm_vsprintf_buf_or_alloc(fmt, fmt, msg_stack, &msg_heap, NULL);
|
||||
|
||||
/* We always print the level and the timestamp.
|
||||
*
|
||||
* Timestamps are very useful for understanding logfiles. While journalctl
|
||||
* might record the timestamp, it is not present in plain `journalctl` output.
|
||||
* Users who report a bug would simply send us the `journalctl` output and
|
||||
* requesting an output with timestamps (even if it's stored somewhere inside
|
||||
* journald) is not workable.
|
||||
*
|
||||
* We print the level, because this too, it's to quickly identify the severity
|
||||
* of a message.
|
||||
*
|
||||
* We also do this for all messages (for all levels), because then the logging
|
||||
* lines are formatted and aligned in a consistent way, which aids reading the
|
||||
* logs. */
|
||||
#define MESSAGE_FMT "%s%-7s [%ld.%04ld] %s"
|
||||
#define MESSAGE_ARG(prefix, tv, msg) \
|
||||
prefix, nm_log_level_desc[level].level_str, (tv).tv_sec, ((tv).tv_usec / 100), (msg)
|
||||
|
|
Loading…
Reference in a new issue