diff options
author | jloup <jloup@jloup.work> | 2018-05-16 23:53:55 +0200 |
---|---|---|
committer | jloup <jloup@jloup.work> | 2018-05-16 23:53:55 +0200 |
commit | 4059b21bd00261699ae6c7619adf053a607073e5 (patch) | |
tree | 9bff5c71c2ec05b23b47099a93fa9febee5ef422 | |
parent | ecb0fb69652ab9545d08b12850e987f53918c110 (diff) | |
download | Front-4059b21bd00261699ae6c7619adf053a607073e5.tar.gz Front-4059b21bd00261699ae6c7619adf053a607073e5.tar.zst Front-4059b21bd00261699ae6c7619adf053a607073e5.zip |
Error 400 are info. Error < 400 are debug.
-rw-r--r-- | api/logger.go | 6 |
1 files changed, 3 insertions, 3 deletions
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 { | |||
43 | var level logrus.Level | 43 | var level logrus.Level |
44 | switch { | 44 | switch { |
45 | case code >= 200 && code < 400: | 45 | case code >= 200 && code < 400: |
46 | level = logrus.InfoLevel | 46 | level = logrus.DebugLevel |
47 | case code >= 400 && code < 500: | 47 | case code >= 400 && code < 500: |
48 | level = logrus.WarnLevel | 48 | level = logrus.InfoLevel |
49 | default: | 49 | default: |
50 | level = logrus.ErrorLevel | 50 | level = logrus.ErrorLevel |
51 | } | 51 | } |
@@ -53,7 +53,7 @@ func Logger() gin.HandlerFunc { | |||
53 | errors := c.Errors.ByType(gin.ErrorTypePrivate) | 53 | errors := c.Errors.ByType(gin.ErrorTypePrivate) |
54 | 54 | ||
55 | for _, err := range errors { | 55 | for _, err := range errors { |
56 | l.Logf(level, "%s: %s", msgLog, err.Err) | 56 | l.WithField("description", err.Err).Logf(level, "%s: %s", msgLog, err.Err) |
57 | } | 57 | } |
58 | 58 | ||
59 | if errors == nil { | 59 | if errors == nil { |