parsing CAPS log levels (#506)
This commit is contained in:
parent
5bdc93f7eb
commit
3543e9d94b
3
log.go
3
log.go
|
@ -105,6 +105,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Level defines log levels.
|
// Level defines log levels.
|
||||||
|
@ -160,7 +161,7 @@ func (l Level) String() string {
|
||||||
// ParseLevel converts a level string into a zerolog Level value.
|
// ParseLevel converts a level string into a zerolog Level value.
|
||||||
// returns an error if the input string does not match known values.
|
// returns an error if the input string does not match known values.
|
||||||
func ParseLevel(levelStr string) (Level, error) {
|
func ParseLevel(levelStr string) (Level, error) {
|
||||||
switch levelStr {
|
switch strings.ToLower(levelStr) {
|
||||||
case LevelFieldMarshalFunc(TraceLevel):
|
case LevelFieldMarshalFunc(TraceLevel):
|
||||||
return TraceLevel, nil
|
return TraceLevel, nil
|
||||||
case LevelFieldMarshalFunc(DebugLevel):
|
case LevelFieldMarshalFunc(DebugLevel):
|
||||||
|
|
Loading…
Reference in New Issue