summaryrefslogtreecommitdiff
path: root/src/libnm-log-core/nm-logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnm-log-core/nm-logging.c')
-rw-r--r--src/libnm-log-core/nm-logging.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libnm-log-core/nm-logging.c b/src/libnm-log-core/nm-logging.c
index 5cce508daf..f53c27c184 100644
--- a/src/libnm-log-core/nm-logging.c
+++ b/src/libnm-log-core/nm-logging.c
@@ -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)