level

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: BSD-3-Clause Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownLevel = errors.New("unknown log level")

Functions

func ToZapLevel

func ToZapLevel(level Level) zapcore.Level

ToZapLevel converts our Level to zapcore.Level

Types

type Level

type Level int8

Level represents a logging level Values are aligned with zapcore.Level for direct casting

const (
	// Verbo is the most verbose level, below debug
	Verbo Level = -2
	// Debug level (matches zapcore.DebugLevel = -1)
	Debug Level = -1
	// Trace level (same as debug since zap doesn't have trace)
	Trace Level = -1
	// Info level (matches zapcore.InfoLevel = 0)
	Info Level = 0
	// Warn level (matches zapcore.WarnLevel = 1)
	Warn Level = 1
	// Error level (matches zapcore.ErrorLevel = 2)
	Error Level = 2
	// Fatal level (matches zapcore.FatalLevel = 5)
	Fatal Level = 5
	// Off disables logging
	Off Level = 6
)

func FromZapLevel

func FromZapLevel(level zapcore.Level) Level

FromZapLevel converts zapcore.Level to our Level

func ToLevel

func ToLevel(l string) (Level, error)

ToLevel converts a string to a Level

func (Level) LowerString

func (l Level) LowerString() string

LowerString returns the lowercase string representation of a Level

func (Level) MarshalJSON

func (l Level) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Level to JSON

func (Level) String

func (l Level) String() string

String returns the string representation of a Level

func (*Level) UnmarshalJSON

func (l *Level) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Level from JSON

Jump to

Keyboard shortcuts

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