logtest

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	DebugLogs Logs
	InfoLogs  Logs
	WarnLogs  Logs
	ErrorLogs Logs
}

func (*Fake) Debug

func (f *Fake) Debug(msg string, ctx ...any)

func (*Fake) DebugCtx

func (f *Fake) DebugCtx(_ context.Context, msg string, args ...any)

func (*Fake) Error

func (f *Fake) Error(msg string, ctx ...any)

func (*Fake) FromContext

func (f *Fake) FromContext(_ context.Context) log.Logger

func (*Fake) Info

func (f *Fake) Info(msg string, ctx ...any)

func (*Fake) InfoCtx

func (f *Fake) InfoCtx(_ context.Context, msg string, args ...any)

func (*Fake) Log

func (f *Fake) Log(keyvals ...any) error

func (*Fake) New

func (f *Fake) New(ctx ...any) *log.ConcreteLogger

func (*Fake) Warn

func (f *Fake) Warn(msg string, ctx ...any)

func (*Fake) WarnCtx

func (f *Fake) WarnCtx(_ context.Context, msg string, args ...any)

type Logs

type Logs struct {
	Calls   int
	Message string
	Ctx     []any
}

type NopHandler

type NopHandler struct{}

func NewNopHandler

func NewNopHandler(t *testing.T) *NopHandler

func (*NopHandler) Enabled

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

func (*NopHandler) Handle

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

func (*NopHandler) WithAttrs

func (h *NopHandler) WithAttrs(_ []slog.Attr) slog.Handler

func (*NopHandler) WithGroup

func (h *NopHandler) WithGroup(_ string) slog.Handler

type TestHandler

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

func NewTestHandler

func NewTestHandler(t *testing.T) *TestHandler

func (*TestHandler) Enabled

func (th *TestHandler) Enabled(_ context.Context, _ slog.Level) bool

func (*TestHandler) Handle

func (th *TestHandler) Handle(ctx context.Context, r slog.Record) error

func (*TestHandler) WithAttrs

func (th *TestHandler) WithAttrs(_ []slog.Attr) slog.Handler

func (*TestHandler) WithGroup

func (th *TestHandler) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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