log

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

The package log provides an abstraction above a specific logger implementation.

Index

Constants

View Source
const (
	DebugLevel                 = Level(zap.DebugLevel)
	InfoLevel                  = Level(zap.InfoLevel)
	WarnLevel                  = Level(zap.WarnLevel)
	ErrorLevel                 = Level(zap.ErrorLevel)
	OutputConsole OutputFormat = "console"
	OutputJSON    OutputFormat = "json"
)

Variables

View Source
var (
	ErrInvalidLevelValue  = errors.New("invalid_level_value")
	ErrInvalidFormatValue = errors.New("invalid_format_value")
)

Functions

This section is empty.

Types

type ConfigurableLogger added in v1.2.0

type ConfigurableLogger interface {
	Logger
	Configure(OutputFormat, Level) error // Configure the logger output format and level.
}

Configurable logger to define additional settings.

func NewLogger

func NewLogger() (ConfigurableLogger, error)

Builds a new logger.

type Level added in v1.2.0

type Level int8 // Log level used by the logger.

func ParseLevel added in v1.2.0

func ParseLevel(lvl string) (Level, error)

Try to parse the given raw level string into a valid log.Level.

type Logger

type Logger interface {
	Error(args ...any)
	Errorw(msg string, keysAndValues ...any)

	Debug(args ...any)
	Debugw(msg string, keysAndValues ...any)

	Info(args ...any)
	Infow(msg string, keysAndValues ...any)

	Warn(args ...any)
	Warnw(msg string, keysAndValues ...any)
}

Logger used to log things out

type OutputFormat added in v1.2.0

type OutputFormat string // Output format used by the logger.

func ParseFormat added in v1.2.0

func ParseFormat(format string) (OutputFormat, error)

Try to parse the given raw format string into a valid log.OutputFormat.

Jump to

Keyboard shortcuts

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