From 801965494c4b3baf7d672347d330b23ce81e52ff Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 31 Aug 2018 14:54:18 +0300 Subject: [PATCH] log: Avoid unnecessary global log prefix changes If the context specifies a log prefix, the global prefix isn't going to be used. --- src/log/log-connection.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/log/log-connection.c b/src/log/log-connection.c index 12e4578fdf..144b46eed4 100644 --- a/src/log/log-connection.c +++ b/src/log/log-connection.c @@ -144,9 +144,13 @@ client_log_ctx(struct log_connection *log, log_error_buffer_add(log->errorbuf, &err); break; } - i_set_failure_prefix("%s", prefix); + /* log_prefix overrides the global prefix. Don't bother changing the + global prefix in that case. */ + if (ctx->log_prefix == NULL) + i_set_failure_prefix("%s", prefix); i_log_type(ctx, "%s", text); - i_set_failure_prefix("%s", global_log_prefix); + if (ctx->log_prefix == NULL) + i_set_failure_prefix("%s", global_log_prefix); } static void