diff options
author | Thomas Haller <thaller@redhat.com> | 2021-02-15 08:47:16 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-02-15 09:16:58 +0100 |
commit | 6da5fc59d860913a278f488f0873ce68f038de2b (patch) | |
tree | 27d4d990ece4ebb4d27b7b0f43a721e70ac2b294 | |
parent | 5ccb8ce17a161fa7e926a1644a4c1aadbf74c002 (diff) | |
download | NetworkManager-6da5fc59d860913a278f488f0873ce68f038de2b.tar.gz |
libnm: log PID in LIBNM_CLIENT_DEBUG debug logging
-rw-r--r-- | libnm/nm-libnm-utils.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libnm/nm-libnm-utils.c b/libnm/nm-libnm-utils.c index 1fb6a47c3d..1000e04d1a 100644 --- a/libnm/nm-libnm-utils.c +++ b/libnm/nm-libnm-utils.c @@ -46,6 +46,7 @@ _nml_dbus_log(NMLDBusLogLevel level, gboolean use_stdout, const char *fmt, ...) va_list args; const char * prefix = ""; gint64 ts; + pid_t pid; /* 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 @@ -89,14 +90,18 @@ _nml_dbus_log(NMLDBusLogLevel level, gboolean use_stdout, const char *fmt, ...) ts = nm_utils_clock_gettime_nsec(CLOCK_BOOTTIME); + pid = getpid(); + if (use_stdout) { - g_print("libnm-dbus: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + g_print("libnm-dbus[%lld]: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + (long long) pid, prefix, ts / NM_UTILS_NSEC_PER_SEC, (ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000, msg); } else { - g_printerr("libnm-dbus: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + g_printerr("libnm-dbus[%lld]: %s[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s\n", + (long long) pid, prefix, ts / NM_UTILS_NSEC_PER_SEC, (ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000, |