MCPcopy
hub / github.com/rs/zerolog / UnmarshalText

Method UnmarshalText

log.go:210–217  ·  view source on GitHub ↗

UnmarshalText implements encoding.TextUnmarshaler to allow for easy reading from toml/yaml/json formats

(text []byte)

Source from the content-addressed store, hash-verified

208
209// UnmarshalText implements encoding.TextUnmarshaler to allow for easy reading from toml/yaml/json formats
210func (l *Level) UnmarshalText(text []byte) error {
211 if l == nil {
212 return errors.New("can't unmarshal a nil *Level")
213 }
214 var err error
215 *l, err = ParseLevel(string(text))
216 return err
217}
218
219// MarshalText implements encoding.TextMarshaler to allow for easy writing into toml/yaml/json formats
220func (l Level) MarshalText() ([]byte, error) {

Callers 2

TestUnmarshalTextLevelFunction · 0.95

Calls 1

ParseLevelFunction · 0.85

Tested by 2

TestUnmarshalTextLevelFunction · 0.76