diff options
author | Thomas Haller <thaller@redhat.com> | 2016-05-23 12:02:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-05-24 19:39:30 +0200 |
commit | a0130e412837096fb57b4b1bad90374fcf5d2f52 (patch) | |
tree | 52eb12880ea545b518fd70cbdef1bcd542c98688 /src/nm-logging.c | |
parent | 13101f8444863c0ae3639658c9c3f35e9487d8dd (diff) | |
download | NetworkManager-a0130e412837096fb57b4b1bad90374fcf5d2f52.tar.gz |
logging: add nm_logging_syslog_enabled() function
We want to know, whether running in debug-mode (logging to stdout)
or whether we log to syslog.
Diffstat (limited to 'src/nm-logging.c')
-rw-r--r-- | src/nm-logging.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c index e517d8d4c6..3f924236e3 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -108,6 +108,7 @@ NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL] = { static struct { NMLogLevel log_level; LogFormatFlags log_format_flags; + bool uses_syslog:1; enum { LOG_BACKEND_GLIB, LOG_BACKEND_SYSLOG, @@ -737,6 +738,12 @@ nm_log_handler (const gchar *log_domain, } } +gboolean +nm_logging_syslog_enabled (void) +{ + return global.uses_syslog; +} + void nm_logging_syslog_openlog (const char *logging_backend) { @@ -756,6 +763,7 @@ nm_logging_syslog_openlog (const char *logging_backend) #if SYSTEMD_JOURNAL } else if (strcmp (logging_backend, "syslog") != 0) { global.log_backend = LOG_BACKEND_JOURNAL; + global.uses_syslog = TRUE; /* 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. */ @@ -763,6 +771,7 @@ nm_logging_syslog_openlog (const char *logging_backend) #endif } else { global.log_backend = LOG_BACKEND_SYSLOG; + global.uses_syslog = TRUE; openlog (G_LOG_DOMAIN, LOG_PID, LOG_DAEMON); } |