log

package
v2.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationAttr

func DurationAttr(duration time.Duration) slog.Attr

func ErrorAnyAttr

func ErrorAnyAttr(err any) slog.Attr

func ErrorAttr

func ErrorAttr(err error) slog.Attr

func ErrorStringAttr

func ErrorStringAttr(errMessage string) slog.Attr

func IterationAttr

func IterationAttr(iteration string) slog.Attr

func IterationStatsGroup

func IterationStatsGroup(started, successful, failed, dropped uint64, period time.Duration) slog.Attr

func NewConsoleLogger

func NewConsoleLogger(config *Config) *slog.Logger

func NewDiscardLogger

func NewDiscardLogger() *slog.Logger

func NewLogger

func NewLogger(output io.Writer, config *Config) *slog.Logger

func NewSlogLogrusLogger

func NewSlogLogrusLogger(logger *slog.Logger) *logrus.Logger

NewSlogLogrusLogger returns a logrus.Logger that will use slog as logging backend.

func NewTestLogger

func NewTestLogger(writer io.Writer) *slog.Logger

func ScenarioAttr

func ScenarioAttr(scenarioName string) slog.Attr

func StackTraceAttr

func StackTraceAttr(stack []byte) slog.Attr

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

func (Config) IsFormatJSON

func (c Config) IsFormatJSON() bool

func (*Config) JSONHandlerOptions

func (c *Config) JSONHandlerOptions() *slog.HandlerOptions

func (*Config) TextHandlerOptions

func (c *Config) TextHandlerOptions() *slog.HandlerOptions

func (*Config) WithJSONFormat

func (c *Config) WithJSONFormat(enabled bool) *Config

func (*Config) WithLevel

func (c *Config) WithLevel(level slog.Level) *Config

type Loggable

type Loggable interface {
	Log(logger *slog.Logger)
}

Jump to

Keyboard shortcuts

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