libct/logs: parse log level implicitly
There's no need to call logrus.ParseLevel as logrus.Level already
implements encoding.TextUnmarshaler interface.
@@ -34,7 +34,7 @@ func processEntry(text []byte) {
}
var jl struct {
- Level string `json:"level"`
+ Level logrus.Level `json:"level"`
Msg string `json:"msg"`
}
if err := json.Unmarshal(text, &jl); err != nil {
@@ -42,10 +42,5 @@ func processEntry(text []byte) {
return
}
- lvl, err := logrus.ParseLevel(jl.Level)
- if err != nil {
- logrus.Errorf("failed to parse log level %q: %v", jl.Level, err)
- return
- }
- logrus.StandardLogger().Logf(lvl, jl.Msg)
+ logrus.StandardLogger().Logf(jl.Level, jl.Msg)
}
