Documentation
¶
Overview ¶
Package slogt integrates testing and log/slog together.
Use of this package means that structured logs produced either by a test of the code under test can be emitted to the test's output. This improves debuggability, as the log output is now attached to the test that caused it to be emitted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONWithOptions ¶
func JSONWithOptions(tb TB, options *slog.HandlerOptions) *slog.Logger
JSONWithOptions creates a new logger using a JSON handler and default options.
func TextWithOptions ¶
func TextWithOptions(tb TB, options *slog.HandlerOptions) *slog.Logger
TextWithOptions creates a new logger using a text handler and the given options.
Types ¶
type TB ¶ added in v0.4.36
TB is a selection of the methods provided by testing.TB.
Click to show internal directories.
Click to hide internal directories.