loghelper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attr

func Attr(args ...any) slog.Attr

Attr parses log args and returns a either a single log attribute or unnamed group.

func Context

func Context(ctx context.Context, args ...any) context.Context

Context returns a copy of parent context with attached log args.

func InitLogging

func InitLogging(opts ...LogOption)

InitLogging initializes default slog logger instance with info log level and stderr as a log output.

Types

type LogOption

type LogOption func(c *logConfig)

func WithLevel

func WithLevel(level slog.Level) LogOption

WithLevel sets default logger log level.

func WithOutput

func WithOutput(w io.Writer) LogOption

WithOutput sets default logger log output.

Jump to

Keyboard shortcuts

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