[feature] attach any request errors if found, only set level=ERROR if code >= 500 (#2300)
This commit is contained in:
parent
c7b6cd7770
commit
ece2e795e0
|
@ -87,9 +87,13 @@ func Logger(logClientIP bool) gin.HandlerFunc {
|
|||
lvl := level.INFO
|
||||
|
||||
if code >= 500 {
|
||||
// This is a server error
|
||||
// Actual server error.
|
||||
lvl = level.ERROR
|
||||
l = l.WithField("error", c.Errors)
|
||||
}
|
||||
|
||||
if len(c.Errors) > 0 {
|
||||
// Always attach any found errors.
|
||||
l = l.WithField("errors", c.Errors)
|
||||
}
|
||||
|
||||
// Get appropriate text for this code.
|
||||
|
|
Loading…
Reference in New Issue