level

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LEVEL

type LEVEL uint8

LEVEL defines a level of logging.

const (
	UNSET LEVEL = 0
	PANIC LEVEL = 1
	FATAL LEVEL = 50
	ERROR LEVEL = 100
	WARN  LEVEL = 150
	INFO  LEVEL = 200
	DEBUG LEVEL = 250
	TRACE LEVEL = 254
	ALL   LEVEL = ^LEVEL(0)
)

Default levels of logging.

func (LEVEL) CanLog

func (loglvl LEVEL) CanLog(lvl LEVEL) bool

CanLog returns whether an incoming log of 'lvl' can be logged against receiving level.

type Levels

type Levels [int(ALL) + 1]string

Levels defines a mapping of log LEVELs to formatted level strings.

func Default

func Default() Levels

Default returns the default set of log levels.

func (Levels) Get

func (l Levels) Get(lvl LEVEL) string

Get fetches the level string for the provided value.

func (Levels) Parse added in v2.0.7

func (l Levels) Parse(s string) (LEVEL, error)

Parse will attempt to decode a LEVEL from given string, checking (case insensitive) against strings in Levels.

Jump to

Keyboard shortcuts

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