summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-util-unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbus/dbus-sysdeps-util-unix.c')
-rw-r--r--dbus/dbus-sysdeps-util-unix.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index 74e8d88f..42693817 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -370,31 +370,50 @@ _dbus_init_system_log (void)
{
openlog ("dbus", LOG_PID, LOG_DAEMON);
}
-
/**
- * Log an informative message. Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
*
+ * @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
+ *
*/
-void
-_dbus_log_info (const char *msg, va_list args)
+void
+_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
{
- vsyslog (LOG_DAEMON|LOG_NOTICE, msg, args);
+ va_list args;
+
+ va_start (args, msg);
+
+ _dbus_system_logv (severity, msg, args);
+
+ va_end (args);
}
/**
- * Log a security-related message. Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
*
+ * @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
+ *
*/
-void
-_dbus_log_security (const char *msg, va_list args)
+void
+_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
{
- vsyslog (LOG_AUTH|LOG_NOTICE, msg, args);
+ int flags;
+ switch (severity)
+ {
+ case DBUS_SYSTEM_LOG_INFO:
+ flags = LOG_DAEMON | LOG_NOTICE;
+ break;
+ case DBUS_SYSTEM_LOG_SECURITY:
+ flags = LOG_AUTH | LOG_NOTICE;
+ break;
+ default:
+ return;
+ }
+ vsyslog (flags, msg, args);
}
/** Installs a UNIX signal handler