MCPcopy
hub / github.com/sirupsen/logrus / MarshalText

Method MarshalText

logrus.go:61–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61func (level Level) MarshalText() ([]byte, error) {
62 switch level {
63 case TraceLevel:
64 return []byte("trace"), nil
65 case DebugLevel:
66 return []byte("debug"), nil
67 case InfoLevel:
68 return []byte("info"), nil
69 case WarnLevel:
70 return []byte("warning"), nil
71 case ErrorLevel:
72 return []byte("error"), nil
73 case FatalLevel:
74 return []byte("fatal"), nil
75 case PanicLevel:
76 return []byte("panic"), nil
77 }
78
79 return nil, fmt.Errorf("not a valid logrus level %d", level)
80}
81
82// AllLevels exposing all logging levels.
83var AllLevels = []Level{

Callers 2

StringMethod · 0.95
TestLevelMarshalTextFunction · 0.80

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestLevelMarshalTextFunction · 0.64