slogger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

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

	DefaultLogLevel = "INFO"
)

log levels.

Variables

This section is empty.

Functions

func New

func New(options ...Option) (*slog.Logger, error)

New instantiates new json logger.

Types

type JSONLogger

type JSONLogger struct {
	Level  slog.Leveler
	Writer io.Writer
}

JSONLogger represents custom logger in JSON format.

type Option

type Option func(*JSONLogger) error

Option represents option function type.

func WithLogLevel

func WithLogLevel(l slog.Leveler) Option

WithLogLevel sets log level.

func WithLogLevelName

func WithLogLevelName(s string) Option

WithLogLevelName sets log level from level name, such as INFO.

func WithWriter

func WithWriter(w io.Writer) Option

WithWriter sets output.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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