info_handler = callback;
}
-static int ATTR_FORMAT(2, 0)
-syslog_handler(int level, const char *format, va_list args)
+static int ATTR_FORMAT(3, 0)
+syslog_handler(int level, enum log_type type, const char *format, va_list args)
{
static int recursed = 0;
recursed++;
- /* make sure there's no %n in there. vsyslog() supports %m, but since
- we'll convert it ourself anyway, we might as well it */
- vsyslog(level, printf_format_fix_unsafe(format), args);
+ /* syslogs don't generatelly bother to log the level in any way,
+ so make sure fatals and panics are shown clearly */
+ if (type == LOG_TYPE_FATAL || type == LOG_TYPE_PANIC) {
+ T_BEGIN {
+ syslog(level, "%s%s", failure_log_type_prefixes[type],
+ t_strdup_vprintf(format, args));
+ } T_END;
+ } else {
+ /* make sure there's no %n in there. vsyslog() supports %m, but
+ since we'll convert it ourself anyway, we might as well it */
+ vsyslog(level, printf_format_fix_unsafe(format), args);
+ }
recursed--;
-
return 0;
}
const char *fmt, va_list args)
{
const char *backtrace;
- if (syslog_handler(LOG_CRIT, fmt, args) < 0 && status == FATAL_DEFAULT)
+ if (syslog_handler(LOG_CRIT, type, fmt, args) < 0 &&
+ status == FATAL_DEFAULT)
status = FATAL_LOGERROR;
if (type == LOG_TYPE_PANIC) {
break;
}
- if (syslog_handler(level, fmt, args) < 0)
+ if (syslog_handler(level, type, fmt, args) < 0)
failure_exit(FATAL_LOGERROR);
}