Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] attach any request errors if found, only set level=ERROR if code >= 500 #2300

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/middleware/logger.go
Expand Up @@ -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.
Expand Down