type Level … const LevelDebug … const LevelInfo … const LevelWarn … const LevelError … // String returns a name for the level. // If the level has a name, then that name // in uppercase is returned. // If the level is between named values, then // an integer is appended to the uppercased name. // Examples: // // LevelWarn.String() => "WARN" // (LevelInfo+2).String() => "INFO+2" func (l Level) String() string { … } // MarshalJSON implements [encoding/json.Marshaler] // by quoting the output of [Level.String]. func (l Level) MarshalJSON() ([]byte, error) { … } // UnmarshalJSON implements [encoding/json.Unmarshaler] // It accepts any string produced by [Level.MarshalJSON], // ignoring case. // It also accepts numeric offsets that would result in a different string on // output. For example, "Error-8" would marshal as "INFO". func (l *Level) UnmarshalJSON(data []byte) error { … } // AppendText implements [encoding.TextAppender] // by calling [Level.String]. func (l Level) AppendText(b []byte) ([]byte, error) { … } // MarshalText implements [encoding.TextMarshaler] // by calling [Level.AppendText]. func (l Level) MarshalText() ([]byte, error) { … } // UnmarshalText implements [encoding.TextUnmarshaler]. // It accepts any string produced by [Level.MarshalText], // ignoring case. // It also accepts numeric offsets that would result in a different string on // output. For example, "Error-8" would marshal as "INFO". func (l *Level) UnmarshalText(data []byte) error { … } func (l *Level) parse(s string) (err error) { … } // Level returns the receiver. // It implements [Leveler]. func (l Level) Level() Level { … } type LevelVar … // Level returns v's level. func (v *LevelVar) Level() Level { … } // Set sets v's level to l. func (v *LevelVar) Set(l Level) { … } func (v *LevelVar) String() string { … } // AppendText implements [encoding.TextAppender] // by calling [Level.AppendText]. func (v *LevelVar) AppendText(b []byte) ([]byte, error) { … } // MarshalText implements [encoding.TextMarshaler] // by calling [LevelVar.AppendText]. func (v *LevelVar) MarshalText() ([]byte, error) { … } // UnmarshalText implements [encoding.TextUnmarshaler] // by calling [Level.UnmarshalText]. func (v *LevelVar) UnmarshalText(data []byte) error { … } type Leveler …