v5.3.0 release notes
- Added
slog.DiscardLogger()
, which redirects logs toio.Discard
. testutil.TestServer
now uses the discard logger by default instead oftestutil.LogWriter
.
This change was made so logs written during tests should usually be silent. To make it more convenient, this is now the default behavior. Sometimes it is still handy to see logs while writing or debugging a test. For this use-case, you can use testutil.LogWriter
:
go
func TestSomething(t *testing.T) {
opts := goyave.Options{
Logger: slog.New(slog.NewHandler(true, &testutil.LogWriter{t: t})),
}
server := testutil.NewTestServerWithOptions(t, opts)
//...
}