mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 03:30:09 +01:00
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.
This commit is contained in:
parent
1463450393
commit
9c01d6ca67
1 changed files with 10 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue