MCPcopy
hub / github.com/uber-go/zap / UnmarshalText

Method UnmarshalText

level.go:134–146  ·  view source on GitHub ↗

UnmarshalText unmarshals the text to an AtomicLevel. It uses the same text representations as the static zapcore.Levels ("debug", "info", "warn", "error", "dpanic", "panic", and "fatal").

(text []byte)

Source from the content-addressed store, hash-verified

132// representations as the static zapcore.Levels ("debug", "info", "warn",
133// "error", "dpanic", "panic", and "fatal").
134func (lvl *AtomicLevel) UnmarshalText(text []byte) error {
135 if lvl.l == nil {
136 lvl.l = &atomic.Int32{}
137 }
138
139 var l zapcore.Level
140 if err := l.UnmarshalText(text); err != nil {
141 return err
142 }
143
144 lvl.SetLevel(l)
145 return nil
146}
147
148// MarshalText marshals the AtomicLevel to a byte slice. It uses the same
149// text representation as the static zapcore.Levels ("debug", "info", "warn",

Callers 1

TestAtomicLevelTextFunction · 0.95

Calls 2

UnmarshalTextMethod · 0.95
SetLevelMethod · 0.95

Tested by 1

TestAtomicLevelTextFunction · 0.76