kslog

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogWithContext

func LogWithContext(ctx context.Context, logger *slog.Logger) *slog.Logger

LogWithContext returns a logger with trace information.

func NewOtelHandler

func NewOtelHandler(next slog.Handler) slog.Handler

NewOtelHandler creates and returns a new OtelHandler to use with log/slog.

Types

type ObservedLogs

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

ObservedLogs is a structure that holds observed logs.

func NewLogObserver

func NewLogObserver() (func(slog.Handler) slog.Handler, *ObservedLogs)

NewLogObserver returns a new observer and the observed logs.

func (*ObservedLogs) All

func (l *ObservedLogs) All() []slog.Record

All returns all the observed logs.

func (*ObservedLogs) Clean

func (l *ObservedLogs) Clean() *ObservedLogs

Clean clears the observed logs.

func (*ObservedLogs) Filter

func (l *ObservedLogs) Filter(filter func(slog.Record) bool) *ObservedLogs

Filter returns a new observed logs with the provided filter applied.

func (*ObservedLogs) Len

func (l *ObservedLogs) Len() int

Len returns the number of observed logs.

Jump to

Keyboard shortcuts

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