log

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug = Level(slog.LevelDebug)
	LevelInfo  = Level(slog.LevelInfo)
	LevelWarn  = Level(slog.LevelWarn)
	LevelError = Level(slog.LevelError)
)

Variables

This section is empty.

Functions

func New

func New(logFile string, level Level, format Format) *slog.Logger

New returns a logger with the given configuration.

Types

type Format

type Format int

Format represents a log output format.

const (
	FormatText Format = iota
	FormatJSON
)

func (*Format) Set

func (f *Format) Set(s string) error

Set updates the value of a Format variable.

Implements the pflag.Value interface.

func (Format) String

func (f Format) String() string

String returns the string representation of a log format.

Implements the fmt.Stringer and pflag.Value interfaces.

func (Format) Type

func (f Format) Type() string

Type returns the string type of a log format.

Implements the pflag.Value interface.

func (*Format) UnmarshalText

func (f *Format) UnmarshalText(text []byte) error

UnmarshalText decodes the text representation of a log format.

Implements the encoding.TextUnmarshaler interface used by mapstructure and viper.

type Level

type Level slog.Level

Level represents a log level threshold.

func (Level) Level

func (l Level) Level() slog.Level

Level returns the slog.Level value of a Level.

Implements the slog.Leveler interface.

func (*Level) Set

func (l *Level) Set(s string) error

Set updates the value of a Level variable.

Implements the pflag.Value interface.

func (Level) String

func (l Level) String() string

String returns the string representation of a log level.

Implements the fmt.Stringer and pflag.Value interfaces.

func (Level) Type

func (l Level) Type() string

Type returns the string type of a log level.

Implements the pflag.Value interface.

func (*Level) UnmarshalText

func (l *Level) UnmarshalText(text []byte) error

UnmarshalText decodes the text representation of a log level.

Implements the encoding.TextUnmarshaler interface used by mapstructure and viper.

Jump to

Keyboard shortcuts

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