Help us shape the future of Go! Take the 2026 Go Developer Survey

testlog

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: GPL-3.0, LGPL-3.0, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package testlog provides a log handler for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(t T, level slog.Level) log.SlogLogger

Logger returns a logger which logs to the unit test log of t.

Types

type T

type T interface {
	Logf(format string, args ...any)
	Helper()
}

T wraps methods from testing.T used by the test logger into an interface. It is specified so that unit tests can instantiate the logger with an implementation of T which can capture the output of logging statements from T.Logf, as this cannot be using testing.T.

Jump to

Keyboard shortcuts

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