From c0b1ea991b0c0a6ba658e2bb54ef96f60e5c091b Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 23 Nov 2014 18:02:34 +0100 Subject: [PATCH] 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 --- hooks/syslog/syslog.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hooks/syslog/syslog.go b/hooks/syslog/syslog.go index 2a18ce6..b6fa374 100644 --- a/hooks/syslog/syslog.go +++ b/hooks/syslog/syslog.go @@ -29,18 +29,18 @@ func (hook *SyslogHook) Fire(entry *logrus.Entry) error { return err } - switch entry.Data["level"] { - case "panic": + switch entry.Level { + case logrus.PanicLevel: return hook.Writer.Crit(line) - case "fatal": + case logrus.FatalLevel: return hook.Writer.Crit(line) - case "error": + case logrus.ErrorLevel: return hook.Writer.Err(line) - case "warn": + case logrus.WarnLevel: return hook.Writer.Warning(line) - case "info": + case logrus.InfoLevel: return hook.Writer.Info(line) - case "debug": + case logrus.DebugLevel: return hook.Writer.Debug(line) default: return nil