logging

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoLoggerInContext = errors.New("no logger in context")
)

Functions

func FromContext

func FromContext(ctx context.Context) (*slog.Logger, error)

func New

func New(cfg LoggerConfig) *slog.Logger

func ToContext

func ToContext(ctx context.Context, log *slog.Logger) context.Context

Types

type LoggerConfig

type LoggerConfig struct {
	Level           string
	Format          string
	WithSource      bool
	WithRequestBody bool
}

type PlainHandler

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

func NewPlainHandler

func NewPlainHandler(w io.Writer, level slog.Leveler) *PlainHandler

func (*PlainHandler) Enabled

func (h *PlainHandler) Enabled(_ context.Context, lvl slog.Level) bool

func (*PlainHandler) Handle

func (h *PlainHandler) Handle(_ context.Context, r slog.Record) error

func (*PlainHandler) WithAttrs

func (h *PlainHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*PlainHandler) WithGroup

func (h *PlainHandler) WithGroup(name string) slog.Handler

func (*PlainHandler) WithSource

func (h *PlainHandler) WithSource(b bool) *PlainHandler

func (*PlainHandler) WithTimestamp

func (h *PlainHandler) WithTimestamp(b bool) *PlainHandler

Jump to

Keyboard shortcuts

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