logger

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LogKey = ctxKeyLog(0)

Variables

This section is empty.

Functions

func ErrorCtx

func ErrorCtx(ctx context.Context, err error) context.Context

func NewMockLogger

func NewMockLogger() *slog.Logger

func SetupLogger

func SetupLogger(env string) *slog.Logger

func WithLogOp

func WithLogOp(ctx context.Context, op string) context.Context

func WithLogRequestID

func WithLogRequestID(ctx context.Context, requestID string) context.Context

func WithLogUserID

func WithLogUserID(ctx context.Context, userID string) context.Context

func Wrap

func Wrap(ctx context.Context, err error) error

Types

type DevelopHandler

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

func NewDevelopHandler

func NewDevelopHandler(h slog.Handler) *DevelopHandler

func (*DevelopHandler) Enabled

func (l *DevelopHandler) Enabled(ctx context.Context, lev slog.Level) bool

func (*DevelopHandler) Handle

func (l *DevelopHandler) Handle(ctx context.Context, rec slog.Record) error

func (*DevelopHandler) WithAttrs

func (l *DevelopHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*DevelopHandler) WithGroup

func (l *DevelopHandler) WithGroup(name string) slog.Handler

type MockHandler

type MockHandler struct{}

func (*MockHandler) Enabled

func (m *MockHandler) Enabled(_ context.Context, _ slog.Level) bool

func (*MockHandler) Handle

func (m *MockHandler) Handle(_ context.Context, _ slog.Record) error

func (*MockHandler) WithAttrs

func (m *MockHandler) WithAttrs(_ []slog.Attr) slog.Handler

func (*MockHandler) WithGroup

func (m *MockHandler) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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