level

package
v1.9.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 5 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLevel = errors.New("invalid error level")

Functions

func LevelsNames

func LevelsNames() []string

LevelsNames returns the name of all available levels.

func LevelsToString

func LevelsToString(levels []Level) string

LevelsToString converts a slice of levels to string (concatenated).

Types

type Level

type Level int

Level specification.

const (
	None Level = iota
	Fatal
	Error
	Info
	Warn
	Debug
	Trace
)

Available levels.

func FromInt

func FromInt(level int) Level

FromInt returns a `Level` from a given integer.

NOTE: Failure will return "Unknown".

func FromString

func FromString(level string) (Level, error)

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

func MustFromString(level string) Level

MustFromString returns a `Level` from a given string. Failure will log, and exit printing available levels.

func (Level) String

func (l Level) String() string

String interface implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL