level

package
v0.0.0-...-ee17956 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package level provides a common definition of the severity of log or trace events. The advantage compared to numeric log levels as used in glog is that the severity is immediately obvious. The levels defined here are intentionally the same as in uber/zap and logrus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Threshold

type Threshold int

Threshold defines the severity of a log or trace event. It satisfies the flag.Value interface and thus can be used like this: var t func init() { flag.Var(&t, "threshold", "")

const (
	// Debug = relevant only for a developer during debugging.
	Debug Threshold = iota
	// Info = informational, may be useful also for users.
	Info
	// Warn = warning, may or may not be something that is worth investigating.
	Warn
	// Error = should not occur during normal operation, but the program can continue.
	Error
	// Fatal = an error that is so severe that the program needs to quit.
	Fatal
	// Panic = an error that is so severe that the program needs to abort.
	Panic

	// Min is the smallest threshold.
	Min = Debug

	// Max is the largest threshold.
	Max = Panic
)

func (*Threshold) Set

func (t *Threshold) Set(value string) error

Set expects the name of a threshold level (like INFO), ignoring the case.

func (Threshold) String

func (t Threshold) String() string

Jump to

Keyboard shortcuts

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