diff options
author | Thomas Haller <thaller@redhat.com> | 2019-10-29 16:50:08 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-11-07 11:34:36 +0100 |
commit | 9c01d6ca6752e9ad93e570c00754dae72d75028a (patch) | |
tree | 78cdbefcab1d754d34c02904ac32624b3ef7a913 | |
parent | 1463450393ca7dade3b4131c4fd26dc03861fe6d (diff) | |
download | NetworkManager-9c01d6ca6752e9ad93e570c00754dae72d75028a.tar.gz |
libnm: print timestamp in LIBNM_CLIENT_DEBUG debug logging
It's useful, because it's easy to get overwhelemed by the logging output.
The timestamp makes it easier to keep track. Also, it allows to see how long
things take.
-rw-r--r-- | libnm/nm-libnm-utils.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libnm/nm-libnm-utils.c b/libnm/nm-libnm-utils.c index 7d34d2fd41..3d7b0ba6df 100644 --- a/libnm/nm-libnm-utils.c +++ b/libnm/nm-libnm-utils.c @@ -8,6 +8,8 @@ #include "nm-libnm-utils.h" +#include "nm-glib-aux/nm-time-utils.h" + /*****************************************************************************/ volatile int _nml_dbus_log_level = 0; @@ -43,6 +45,7 @@ _nml_dbus_log (NMLDBusLogLevel level, gs_free char *msg = NULL; va_list args; const char *prefix = ""; + gint64 ts; /* we only call _nml_dbus_log() after nml_dbus_log_enabled(), which already does * an atomic access to the variable. Since the value is only initialized once and @@ -84,7 +87,13 @@ _nml_dbus_log (NMLDBusLogLevel level, break; } - g_printerr ("libnm-dbus: %s%s\n", prefix, msg); + ts = nm_utils_clock_gettime_ns (CLOCK_BOOTTIME); + + g_printerr ("libnm-dbus: %s[%"G_GINT64_FORMAT".%05"G_GINT64_FORMAT"] %s\n", + prefix, + ts / NM_UTILS_NS_PER_SECOND, + (ts / (NM_UTILS_NS_PER_SECOND / 10000)) % 10000, + msg); } /*****************************************************************************/ |