diff options
author | Thomas Haller <thaller@redhat.com> | 2018-06-21 08:59:23 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-06-27 09:14:36 +0200 |
commit | 2912155584fa9e7b92940ecddf3048c74212d63f (patch) | |
tree | 451f130751dca841ab06f2dcde0d630e53dec554 | |
parent | 4439b6a35d53149e5e2543db8772885f4b51d667 (diff) | |
download | NetworkManager-2912155584fa9e7b92940ecddf3048c74212d63f.tar.gz |
logging: move fetching monotonic timestamp to end of nm_logging_syslog_openlog()
It just makes more sense to first fully setup logging, and then fetching
the timestamp. In practice, the effect previously was very similar.
-rw-r--r-- | src/nm-logging.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c index 11e05c31f7..9ac79a45b4 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -832,6 +832,8 @@ nm_logging_set_prefix (const char *format, ...) void nm_logging_syslog_openlog (const char *logging_backend, gboolean debug) { + gboolean fetch_monotonic_timestamp = FALSE; + if (global.log_backend != LOG_BACKEND_GLIB) g_return_if_reached (); @@ -843,10 +845,7 @@ nm_logging_syslog_openlog (const char *logging_backend, gboolean debug) global.log_backend = LOG_BACKEND_JOURNAL; global.uses_syslog = TRUE; global.debug_stderr = debug; - - /* ensure we read a monotonic timestamp. Reading the timestamp the first - * time causes a logging message. We don't want to do that during _nm_log_impl. */ - nm_utils_get_monotonic_timestamp_ns (); + fetch_monotonic_timestamp = TRUE; } else #endif { @@ -860,5 +859,10 @@ nm_logging_syslog_openlog (const char *logging_backend, gboolean debug) G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, nm_log_handler, NULL); -} + if (fetch_monotonic_timestamp) { + /* ensure we read a monotonic timestamp. Reading the timestamp the first + * time causes a logging message. We don't want to do that during _nm_log_impl. */ + nm_utils_get_monotonic_timestamp_ns (); + } +} |