slog

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provider

func Provider(ctx context.Context, cfg *viper.Viper) (providers.Logger, error)

Provider returns a slog logger

Types

type Logger

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

Logger is an slog logger that implements the logging.Logger interface

func NewJSONLogger

func NewJSONLogger(opts *slog.HandlerOptions) *Logger

NewJSONLogger returns a new json logger

func NewTextLogger

func NewTextLogger(opts *slog.HandlerOptions) *Logger

NewTextLogger returns a new text logger

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string, tags ...map[string]any)

Debug logs a debug message

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, tags ...map[string]any)

Error logs an error message

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, tags ...map[string]any)

Info logs an info message

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, tags ...map[string]any)

Warn logs a warning message

Jump to

Keyboard shortcuts

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