Expose all levels (for hooks).

This commit is contained in:
Joern Barthel
2015-05-13 14:12:36 +02:00
parent 57cce1ed61
commit 088ac1380d
2 changed files with 11 additions and 8 deletions
+1 -8
View File
@@ -50,12 +50,5 @@ func (hook *SyslogHook) Fire(entry *logrus.Entry) error {
} }
func (hook *SyslogHook) Levels() []logrus.Level { func (hook *SyslogHook) Levels() []logrus.Level {
return []logrus.Level{ return logrus.AllLevels
logrus.PanicLevel,
logrus.FatalLevel,
logrus.ErrorLevel,
logrus.WarnLevel,
logrus.InfoLevel,
logrus.DebugLevel,
}
} }
+10
View File
@@ -53,6 +53,16 @@ func ParseLevel(lvl string) (Level, error) {
return l, fmt.Errorf("not a valid logrus Level: %q", lvl) return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
} }
// A constant exposing all logging levels
var AllLevels = []Level{
PanicLevel,
FatalLevel,
ErrorLevel,
WarnLevel,
InfoLevel,
DebugLevel,
}
// These are the different logging levels. You can set the logging level to log // These are the different logging levels. You can set the logging level to log
// on your instance of logger, obtained with `logrus.New()`. // on your instance of logger, obtained with `logrus.New()`.
const ( const (