levels.go
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
}
// UnmarshalJSON implements json.Unamrshaler interface.