summaryrefslogtreecommitdiff
path: root/internal/middleware/logger.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/middleware/logger.go')
-rw-r--r--internal/middleware/logger.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/middleware/logger.go b/internal/middleware/logger.go
index 58f90b088..f9b81d58a 100644
--- a/internal/middleware/logger.go
+++ b/internal/middleware/logger.go
@@ -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.