dovecot-1.2: Logging: Support specifying a prefix also for syslo...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Nov 15 19:55:25 EET 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/511ceaaa2268
changeset: 8407:511ceaaa2268
user: Timo Sirainen <tss at iki.fi>
date: Sat Nov 15 19:46:46 2008 +0200
description:
Logging: Support specifying a prefix also for syslog logging.
diffstat:
2 files changed, 8 insertions(+), 11 deletions(-)
src/lib/failures.c | 17 +++++++----------
src/lib/failures.h | 2 +-
diffs (39 lines):
diff -r ed4d6fc5712b -r 511ceaaa2268 src/lib/failures.c
--- a/src/lib/failures.c Sat Nov 15 19:37:35 2008 +0200
+++ b/src/lib/failures.c Sat Nov 15 19:46:46 2008 +0200
@@ -284,16 +284,13 @@ syslog_handler(int level, enum log_type
/* 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;
}
diff -r ed4d6fc5712b -r 511ceaaa2268 src/lib/failures.h
--- a/src/lib/failures.h Sat Nov 15 19:37:35 2008 +0200
+++ b/src/lib/failures.h Sat Nov 15 19:46:46 2008 +0200
@@ -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. */
More information about the dovecot-cvs
mailing list