diff options
author | Simon McVittie <smcv@debian.org> | 2016-07-20 10:07:12 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-08-11 16:41:16 +0100 |
commit | a2271779184676b9ff1f5b4d660a85abc63c263f (patch) | |
tree | 30ebfa93dddd538550c1c5fbbffa295a4e1e271d /dbus/dbus-sysdeps-util-win.c | |
parent | e3d76634c33197ad9e29b45993a27c0580b57e00 (diff) |
sysdeps: move _dbus_system_log() into the shared library
This is in preparation for optionally making _dbus_warn() use it.
dbus-daemon closes its stderr under some circumstances, including
when launched by dbus-launch, which makes failures in that
situation rather hard to debug.
_dbus_system_log() is the same on Unix and Windows, so move it
to dbus-sysdeps.c. _dbus_system_logv() remains platform-specific.
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
[smcv: move the #include for syslog.h, too]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-sysdeps-util-win.c')
-rw-r--r-- | dbus/dbus-sysdeps-util-win.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 789bd183..dacb8d2e 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -296,63 +296,6 @@ _dbus_rlimit_free (DBusRLimit *lim) _dbus_assert (lim == NULL); } -void -_dbus_init_system_log (dbus_bool_t is_daemon) -{ - /* OutputDebugStringA doesn't need any special initialization, do nothing */ -} - -/** - * 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 - */ -void -_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) -{ - va_list args; - - va_start (args, msg); - - _dbus_system_logv (severity, msg, args); - - va_end (args); -} - -/** - * 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 - * - * If the FATAL severity is given, this function will terminate the program - * with an error code. - */ -void -_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args) -{ - char *s = ""; - char buf[1024]; - char format[1024]; - - 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; - } - - snprintf(format, sizeof(format), "%s%s", s ,msg); - vsnprintf(buf, sizeof(buf), format, args); - OutputDebugStringA(buf); - - if (severity == DBUS_SYSTEM_LOG_FATAL) - exit (1); -} - /** Installs a signal handler * * @param sig the signal to handle |