]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 7 Sep 2018 07:41:16 +0000 (10:41 +0300)
If the context specifies a log prefix, the global prefix isn't going to be
used.

src/log/log-connection.c

index 12e4578fdf6557a43f1f43a8596b6c845b2579ad..144b46eed44ec4070425ca2e2462b65620c645d4 100644 (file)
@@ -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