Fix incorrect router logger (#26137)

A low-level mistake:

* `log.Info` is global `Info` function, which calls "default" logger
* `logger.Info` is the for router's logger
This commit is contained in:
wxiaoguang 2023-07-26 06:21:09 +08:00 committed by GitHub
parent e62ea96ada
commit 3e4a4f9c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -89,13 +89,13 @@ func logPrinter(logger log.Logger) func(trigger Event, record *requestRecord) {
if v, ok := record.responseWriter.(types.ResponseStatusProvider); ok { if v, ok := record.responseWriter.(types.ResponseStatusProvider); ok {
status = v.WrittenStatus() status = v.WrittenStatus()
} }
logf := log.Info logf := logger.Info
if strings.HasPrefix(req.RequestURI, "/assets/") { if strings.HasPrefix(req.RequestURI, "/assets/") {
logf = log.Trace logf = logger.Trace
} }
message := completedMessage message := completedMessage
if isUnknownHandler { if isUnknownHandler {
logf = log.Error logf = logger.Error
message = unknownHandlerMessage message = unknownHandlerMessage
} }