]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
log: Avoid unnecessary global log prefix changes
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 31 Aug 2018 11:54:18 +0000 (14:54 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 3 Sep 2018 08:46:58 +0000 (08:46 +0000)
If the context specifies a log prefix, the global prefix isn't going to be
used.

src/log/log-connection.c

index db268ff6e1b42a2b24d8a5364e24f3332fc53f8f..86770434785b303b6c6a8e46a86600d73d988884 100644 (file)
@@ -145,9 +145,13 @@ client_log_ctx(struct log_connection *log,
        case LOG_TYPE_COUNT:
                i_unreached();
        }
-       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