]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Logging: Support specifying a prefix also for syslog logging.
authorTimo Sirainen <tss@iki.fi>
Sat, 15 Nov 2008 17:46:46 +0000 (19:46 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 15 Nov 2008 17:46:46 +0000 (19:46 +0200)
--HG--
branch : HEAD

src/lib/failures.c
src/lib/failures.h

index bcc1da786dfff6d9d56402e118812e9a9b5781a4..b8999b912264aa1b263e4d18048954a8d9a86115 100644 (file)
@@ -284,16 +284,13 @@ syslog_handler(int level, enum log_type type, const char *format, va_list 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);
-       }
+       T_BEGIN {
+               syslog(level, "%s%s%s",
+                      log_prefix == NULL ? "" : log_prefix,
+                      type == LOG_TYPE_FATAL || type == LOG_TYPE_PANIC ?
+                      failure_log_type_prefixes[type] : "",
+                      t_strdup_vprintf(format, args));
+       } T_END;
        recursed--;
        return 0;
 }
index ec024cbe930f7f0947404d021de3404de4ad099c..3dec3d64505ae6d3d99f535821b6c490168f6aba 100644 (file)
@@ -76,7 +76,7 @@ void i_set_failure_internal(void);
    functions modify the info file too, so call this function after them. */
 void i_set_info_file(const char *path);
 
-/* Set the failure prefix. This is used only when logging to a file. */
+/* Set the failure prefix. */
 void i_set_failure_prefix(const char *prefix);
 
 /* Prefix failures with a timestamp. fmt is in strftime() format. */