Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 02:36:10 +01:00

Fix incorrect router logger (#26137) (#26143)

Backport #26137 by @wxiaoguang

A low-level mistake:

* `log.Info` is global `Info` function, which calls "default" logger
* `logger.Info` is the for router's logger

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 782b137682)
This commit is contained in:
Giteabot 2023-07-25 20:37:43 -04:00 committed by Earl Warren
parent d9d38b6244
commit f4a8f10f64
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -89,13 +89,13 @@ func logPrinter(logger log.Logger) func(trigger Event, record *requestRecord) {
if v, ok := record.responseWriter.(context.ResponseWriter); ok { if v, ok := record.responseWriter.(context.ResponseWriter); ok {
status = v.Status() status = v.Status()
} }
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
} }