Skip to content

Commit

Permalink
Merge pull request #11 from uniplaces/UN-19708/Fix-go-logger-to-log-l…
Browse files Browse the repository at this point in the history
…evel-as-string-instead-of-int

[RFC][UN-19798] Fix level as string instead of int
  • Loading branch information
rntdrts authored Jan 10, 2020
2 parents 9f6de09 + 80b9b1e commit 35fcd72
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions internal/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewLogrusLogger(level string, env string, writer io.Writer, defaultFields m
Logger: logrus.New(),
}

instance.Formatter = getFormatter(env)
instance.Formatter = &logrus.JSONFormatter{}
instance.Level = logrusLevel
instance.Out = writer

Expand All @@ -61,18 +61,6 @@ func NewLogrusLogger(level string, env string, writer io.Writer, defaultFields m
return instance
}

func getFormatter(env string) logrus.Formatter {
if env == devEnvironment || env == testEnvironment {
return &logrus.TextFormatter{
EnableIntLogLevels: true,
}
}

return &logrus.JSONFormatter{
EnableIntLogLevels: true,
}
}

func (logger logrusLogger) ErrorWithFields(err error, fields map[string]interface{}) {
stackTrace := logger.getErrorLevelStackTrace(err)

Expand Down

0 comments on commit 35fcd72

Please sign in to comment.