grip: github.com/tychoish/grip/level Index | Files

package level

import "github.com/tychoish/grip/level"

Package level defines a Priority type and some conversion methods for a 7-tiered logging level schema, which mirror syslog and system's logging levels.

Levels range from Emergency (0) to Debug (7), and the special type Priority and associated constants provide access to these values.

Index

Package Files

level.go

type Priority Uses

type Priority int16

Priority is an integer that tracks log levels. Use with one of the defined constants.

const (
    Emergency Priority = 100
    Alert     Priority = 90
    Critical  Priority = 80
    Error     Priority = 70
    Warning   Priority = 60
    Notice    Priority = 50
    Info      Priority = 40
    Debug     Priority = 30
    Trace     Priority = 20
    Invalid   Priority = 0
)

Constants defined for easy access to

func FromString Uses

func FromString(l string) Priority

FromString takes a string, (case insensitive, leading and trailing space removed, )

func (Priority) IsValid Uses

func (p Priority) IsValid() bool

IsValid returns false when the priority valid is not a valid priority value.

func (Priority) String Uses

func (p Priority) String() string

String implements the Stringer interface and makes it possible to print human-readable string identifier for a log level.

Package level imports 1 packages (graph) and is imported by 1 packages. Updated 2020-02-28. Refresh now. Tools for package owners.