From ba1d6e3664a8f18bf81966116bafad1348542753 Mon Sep 17 00:00:00 2001 From: Alex Last Date: Tue, 5 Mar 2024 04:14:54 +0000 Subject: [PATCH] fix: only add log middleware to not found handler when enabled (#3969) --- rest/engine.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rest/engine.go b/rest/engine.go index a206b3ce..e57786ca 100644 --- a/rest/engine.go +++ b/rest/engine.go @@ -217,9 +217,12 @@ func (ng *engine) notFoundHandler(next http.Handler) http.Handler { handler.TraceHandler(ng.conf.Name, "", handler.WithTraceIgnorePaths(ng.conf.TraceIgnorePaths)), - ng.getLogHandler(), ) + if ng.conf.Middlewares.Log { + chn = chn.Append(ng.getLogHandler()) + } + var h http.Handler if next != nil { h = chn.Then(next)