mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
fix: only add log middleware to not found handler when enabled (#3969)
This commit is contained in:
parent
2096cd5749
commit
ba1d6e3664
@ -217,9 +217,12 @@ func (ng *engine) notFoundHandler(next http.Handler) http.Handler {
|
|||||||
handler.TraceHandler(ng.conf.Name,
|
handler.TraceHandler(ng.conf.Name,
|
||||||
"",
|
"",
|
||||||
handler.WithTraceIgnorePaths(ng.conf.TraceIgnorePaths)),
|
handler.WithTraceIgnorePaths(ng.conf.TraceIgnorePaths)),
|
||||||
ng.getLogHandler(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ng.conf.Middlewares.Log {
|
||||||
|
chn = chn.Append(ng.getLogHandler())
|
||||||
|
}
|
||||||
|
|
||||||
var h http.Handler
|
var h http.Handler
|
||||||
if next != nil {
|
if next != nil {
|
||||||
h = chn.Then(next)
|
h = chn.Then(next)
|
||||||
|
Loading…
Reference in New Issue
Block a user