testlogger

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testlogger provides test-scoped slog loggers that direct output to testing.T.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachToContext

func AttachToContext(t testing.TB) context.Context

AttachToContext returns a new context with a test logger attached.

func New

func New(t testing.TB) *slog.Logger

New delegates to NewLeveled passing debug as the minimum level.

func NewLeveled

func NewLeveled(t testing.TB, level slog.Level) *slog.Logger

NewLeveled returns an slog.Logger that directs all output to t.Log. Log statements are printed only in case of a failed test or if go test was invoked with -v flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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