Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLevel = errors.New("invalid error level")
Functions ¶
func LevelsNames ¶
func LevelsNames() []string
LevelsNames returns the name of all available levels.
func LevelsToString ¶
LevelsToString converts a slice of levels to string (concatenated).
Types ¶
type Level ¶
type Level int
Level specification.
V2 BREAKING CHANGE: levels follow the CONVENTIONAL order - None(0) Fatal(1) Error(2) Warn(3) Info(4) Debug(5) Trace(6). In v1, Info(3) came before Warn(4), so an output capped at Info HID warnings. In v2, Warn nests below Info: `SetMaxLevel(Info)` SHOWS warnings, and each cap admits every level at, or below it. Code relying on v1's numeric values (e.g. `FromInt(3)` meaning Info, or persisted integers) must be migrated - see MIGRATION-V2.md. Name-based lookups (`FromString`, `MustFromString`, `String`) are unaffected.
func FromInt ¶
FromInt returns a `Level` from a given integer.
V2 BREAKING CHANGE: integers follow the v2 conventional order - FromInt(3) is now Warn, and FromInt(4) is now Info (swapped from v1).
NOTE: Failure will return "Unknown".
func FromString ¶
FromString returns a `Level` from a given string. It can also be used to validate if a given string, is a `Level`. An invalid level will return `None` as `Level`, and not ok (`false`).
func MustFromString ¶
MustFromString returns a `Level` from a given string. Failure will log, and exit printing available levels.