func (level *Level) UnmarshalJSON(data []byte) error {
	switch string(bytes.ToUpper(data)) {
	case `"EMERGENCY"`, "0":
		*level = EMERGENCY
	case `"ALERT"`, "1":
		*level = ALERT
	case `"CRITICAL"`, "2":
		*level = CRITICAL
	case `"ERROR"`, "3":
		*level = ERROR
	case `"WARNING"`, "4":
		*level = WARNING
	case `"NOTICE"`, "5":
		*level = NOTICE
	case `"INFO"`, "6":
		*level = INFO
	case `"DEBUG"`, "7":
		*level = DEBUG
	default:
		return ErrInvalidLevel
	}
	return nil
}
func (level *Level) UnmarshalJSON(data []byte) error {
	switch string(bytes.ToUpper(data)) {
	case `"EMERGENCY"`, "0":
		*level = EMERGENCY
	case `"ALERT"`, "1":
		*level = ALERT
	case `"CRITICAL"`, "2":
		*level = CRITICAL
	case `"ERROR"`, "3":
		*level = ERROR
	case `"WARNING"`, "4":
		*level = WARNING
	case `"NOTICE"`, "5":
		*level = NOTICE
	case `"INFO"`, "6":
		*level = INFO
	case `"DEBUG"`, "7":
		*level = DEBUG
	default:
		return ErrInvalidLevel
	}
	return nil
}
func ( level * Level ) UnmarshalJSON ( data [ ] byte ) error { switch string ( bytes . ToUpper ( data ) ) { case `"EMERGENCY"` , " " : * level = EMERGENCY case `"ALERT"` , " " : * level = ALERT case `"CRITICAL"` , " " : * level = CRITICAL case `"ERROR"` , " " : * level = ERROR case `"WARNING"` , " " : * level = WARNING case `"NOTICE"` , " " : * level = NOTICE case `"INFO"` , " " : * level = INFO case `"DEBUG"` , " " : * level = DEBUG default : return ErrInvalidLevel } return nil }
// UnmarshalJSON implements json.Unamrshaler interface.
UnmarshalJSON implements json . Unamrshaler interface .