levels

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type int
const (
	Trace Type = iota
	Debug
	Info
	Warn
	Error
	Panic
	Fatal
	Silent
)

func FromDebug

func FromDebug(debug ...bool) Type

FromDebug returns the debug level type if debug argument is true, or the info level type if debug argument if false or missing. This facilitates setting the log level via config or environment variable by value in a predictable way. Example:

true      => level.Debug
false     => level.Info
<nothing> => level.Info

func FromString

func FromString(s string) Type

FromString returns a Level type for the named log level, or "Undef" if the level string is invalid. This facilitates setting the log level via config or environment variable by name in a predictable way. Example:

"debug" => level.Debug

The Level string argument `s` is NOT "case-sensitive", i.e.:

Accept both "INFO" and "info".

func (Type) Bracket

func (l Type) Bracket() string

func (Type) Color

func (l Type) Color() *color.Color

func (Type) Output

func (l Type) Output() io.Writer

func (Type) String

func (l Type) String() string

Jump to

Keyboard shortcuts

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