UnmarshalText implements encoding.TextUnmarshaler to allow for easy reading from toml/yaml/json formats
(text []byte)
| 208 | |
| 209 | // UnmarshalText implements encoding.TextUnmarshaler to allow for easy reading from toml/yaml/json formats |
| 210 | func (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 |
| 220 | func (l Level) MarshalText() ([]byte, error) { |