mirror of https://github.com/sirupsen/logrus.git
parent
4617ccb653
commit
45d5602d9c
|
@ -31,6 +31,7 @@ func (level Level) String() string {
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseLevel takes a string level and returns the Logrus log level constant.
|
||||||
func ParseLevel(lvl string) (Level, error) {
|
func ParseLevel(lvl string) (Level, error) {
|
||||||
switch lvl {
|
switch lvl {
|
||||||
case "panic":
|
case "panic":
|
||||||
|
@ -43,13 +44,12 @@ func ParseLevel(lvl string) (Level, error) {
|
||||||
return WarnLevel, nil
|
return WarnLevel, nil
|
||||||
case "info":
|
case "info":
|
||||||
return InfoLevel, nil
|
return InfoLevel, nil
|
||||||
case "debug", "dbg":
|
case "debug":
|
||||||
return DebugLevel, nil
|
return DebugLevel, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var l Level
|
var l Level
|
||||||
return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
|
return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
Loading…
Reference in New Issue