MarshalJSON marshals a level number to a JSON string
()
| 93 | |
| 94 | // MarshalJSON marshals a level number to a JSON string |
| 95 | func (level LogLevel) MarshalJSON() ([]byte, error) { |
| 96 | levelString, err := level.Name() |
| 97 | if err != nil { |
| 98 | return nil, err |
| 99 | } |
| 100 | return json.Marshal(levelString) |
| 101 | } |
| 102 | |
| 103 | // UnmarshalYAML decodes a YAML level string to a level type. |
| 104 | func (level *LogLevel) UnmarshalYAML(unmarshal func(interface{}) error) error { |