forked from mirror/logrus
Expose all levels (for hooks).
This commit is contained in:
parent
57cce1ed61
commit
088ac1380d
|
@ -50,12 +50,5 @@ func (hook *SyslogHook) Fire(entry *logrus.Entry) error {
|
|||
}
|
||||
|
||||
func (hook *SyslogHook) Levels() []logrus.Level {
|
||||
return []logrus.Level{
|
||||
logrus.PanicLevel,
|
||||
logrus.FatalLevel,
|
||||
logrus.ErrorLevel,
|
||||
logrus.WarnLevel,
|
||||
logrus.InfoLevel,
|
||||
logrus.DebugLevel,
|
||||
}
|
||||
return logrus.AllLevels
|
||||
}
|
||||
|
|
10
logrus.go
10
logrus.go
|
@ -53,6 +53,16 @@ func ParseLevel(lvl string) (Level, error) {
|
|||
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
|
||||
// on your instance of logger, obtained with `logrus.New()`.
|
||||
const (
|
||||
|
|
Loading…
Reference in New Issue