Commit 00e031a5 authored by Colin Walters's avatar Colin Walters
Browse files

Add DBUS_SYSTEM_LOG_FATAL severity

This severity is useful for when we encounter a fatal problem; we
get a log message out, then exit.
parent 04cf3166
......@@ -397,6 +397,8 @@ _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
* @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)
......@@ -410,10 +412,16 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args
case DBUS_SYSTEM_LOG_SECURITY:
flags = LOG_AUTH | LOG_NOTICE;
break;
case DBUS_SYSTEM_LOG_FATAL:
flags = LOG_DAEMON|LOG_CRIT;
default:
return;
}
vsyslog (flags, msg, args);
if (severity == DBUS_SYSTEM_LOG_FATAL)
exit (1);
}
/** Installs a UNIX signal handler
......
......@@ -442,7 +442,8 @@ void _dbus_init_system_log (void);
typedef enum {
DBUS_SYSTEM_LOG_INFO,
DBUS_SYSTEM_LOG_SECURITY
DBUS_SYSTEM_LOG_SECURITY,
DBUS_SYSTEM_LOG_FATAL
} DBusSystemLogSeverity;
void _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment