forked from mirror/logrus
syslog: let syslog output lookup level directly in Entry struct
Log level has moved from `entry.Data["level"]` to `entry.Level`. Use that to get the right level. Fix: #82
This commit is contained in:
parent
66afa87e45
commit
c0b1ea991b
|
@ -29,18 +29,18 @@ func (hook *SyslogHook) Fire(entry *logrus.Entry) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch entry.Data["level"] {
|
switch entry.Level {
|
||||||
case "panic":
|
case logrus.PanicLevel:
|
||||||
return hook.Writer.Crit(line)
|
return hook.Writer.Crit(line)
|
||||||
case "fatal":
|
case logrus.FatalLevel:
|
||||||
return hook.Writer.Crit(line)
|
return hook.Writer.Crit(line)
|
||||||
case "error":
|
case logrus.ErrorLevel:
|
||||||
return hook.Writer.Err(line)
|
return hook.Writer.Err(line)
|
||||||
case "warn":
|
case logrus.WarnLevel:
|
||||||
return hook.Writer.Warning(line)
|
return hook.Writer.Warning(line)
|
||||||
case "info":
|
case logrus.InfoLevel:
|
||||||
return hook.Writer.Info(line)
|
return hook.Writer.Info(line)
|
||||||
case "debug":
|
case logrus.DebugLevel:
|
||||||
return hook.Writer.Debug(line)
|
return hook.Writer.Debug(line)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue