Documentation
¶
Overview ¶
Package slogstringlevel provides a string that implements slog.Leveler. Useful for unmarshalling from a string value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SlogStringLevel ¶
type SlogStringLevel string
SlogStringLevel is a string that implements slog.Leveler.
const ( LevelDebug SlogStringLevel = "debug" LevelInfo SlogStringLevel = "info" LevelWarn SlogStringLevel = "warn" LevelError SlogStringLevel = "error" )
func (SlogStringLevel) Level ¶
func (l SlogStringLevel) Level() slog.Level
Level returns the slog.Level corresponding to the SlogStringLevel.
func (*SlogStringLevel) UnmarshalText ¶ added in v1.1.0
func (l *SlogStringLevel) UnmarshalText(text []byte) error
UnmarshalText unmarshals a string into a SlogStringLevel. It first trims the string and converts it to lowercase and then tries to match it to a valid SlogStringLevel. Returns an error if the string is not a valid SlogStringLevel.
Click to show internal directories.
Click to hide internal directories.