From ec0c4f24a940fa619e7f60fc3617754db80518bb Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 3 Nov 2014 16:04:45 +0000 Subject: [PATCH 1/2] DBusSystemLogSeverity: add DBUS_SYSTEM_LOG_WARNING --- dbus/dbus-sysdeps-util-unix.c | 3 +++ dbus/dbus-sysdeps-util-win.c | 1 + dbus/dbus-sysdeps.h | 1 + test/internals/syslog.c | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index d104e41..f410806 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -485,6 +485,9 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args case DBUS_SYSTEM_LOG_INFO: flags = LOG_DAEMON | LOG_NOTICE; break; + case DBUS_SYSTEM_LOG_WARNING: + flags = LOG_DAEMON | LOG_WARNING; + break; case DBUS_SYSTEM_LOG_SECURITY: flags = LOG_AUTH | LOG_NOTICE; break; diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index dd53417..dd4b233 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -306,6 +306,7 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args switch(severity) { case DBUS_SYSTEM_LOG_INFO: s = "info"; break; + case DBUS_SYSTEM_LOG_WARNING: s = "warning"; break; case DBUS_SYSTEM_LOG_SECURITY: s = "security"; break; case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break; } diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 03248f0..a78390e 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -452,6 +452,7 @@ void _dbus_init_system_log (dbus_bool_t is_daemon); typedef enum { DBUS_SYSTEM_LOG_INFO, + DBUS_SYSTEM_LOG_WARNING, DBUS_SYSTEM_LOG_SECURITY, DBUS_SYSTEM_LOG_FATAL } DBusSystemLogSeverity; diff --git a/test/internals/syslog.c b/test/internals/syslog.c index 7e0eae7..80a0ceb 100644 --- a/test/internals/syslog.c +++ b/test/internals/syslog.c @@ -68,16 +68,18 @@ test_syslog (Fixture *f, { _dbus_init_system_log (FALSE); _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42); + _dbus_system_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45); _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666); exit (0); } g_test_trap_assert_passed (); - g_test_trap_assert_stderr ("*" MESSAGE "42\n*" MESSAGE "666\n*"); + g_test_trap_assert_stderr ("*" MESSAGE "42\n*" MESSAGE "45\n*" MESSAGE "666\n*"); #endif /* manual test (this is the best we can do on Windows) */ _dbus_init_system_log (FALSE); _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42); + _dbus_system_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45); _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666); } -- 1.8.5.3