From: jloup Date: Wed, 16 May 2018 21:53:55 +0000 (+0200) Subject: Error 400 are info. Error < 400 are debug. X-Git-Tag: v0.0.19~1 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git;a=commitdiff_plain;h=4059b21bd00261699ae6c7619adf053a607073e5 Error 400 are info. Error < 400 are debug. --- diff --git a/api/logger.go b/api/logger.go index 5f49d29..1016863 100644 --- a/api/logger.go +++ b/api/logger.go @@ -43,9 +43,9 @@ func Logger() gin.HandlerFunc { var level logrus.Level switch { case code >= 200 && code < 400: - level = logrus.InfoLevel + level = logrus.DebugLevel case code >= 400 && code < 500: - level = logrus.WarnLevel + level = logrus.InfoLevel default: level = logrus.ErrorLevel } @@ -53,7 +53,7 @@ func Logger() gin.HandlerFunc { errors := c.Errors.ByType(gin.ErrorTypePrivate) for _, err := range errors { - l.Logf(level, "%s: %s", msgLog, err.Err) + l.WithField("description", err.Err).Logf(level, "%s: %s", msgLog, err.Err) } if errors == nil {