test

package
v0.0.0-...-62a058d Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package test provides useful test helpers that can be used in multiple packages.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTime = time.Date(2023, 9, 29, 13, 0, 59, 0, time.UTC)

DefaultTime is a single point in time to use for log lines

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Records []slog.Record
	Ctxs    []context.Context
	Source  bool
}

Handler is a slog.Handler that records the records that come its way

func (*Handler) Enabled

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

Enabled returns true

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, r slog.Record) error

Handle records a log record

func (*Handler) MarshalJSON

func (h *Handler) MarshalJSON() ([]byte, error)

MarshalJSON formats all log records with slog.JSONHandler

func (*Handler) String

func (h *Handler) String() string

String formats all log records with slog.TextHandler

func (*Handler) WithAttrs

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

WithAttrs panics

func (*Handler) WithGroup

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

WithGroup panics

Jump to

Keyboard shortcuts

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