What's Changed
- Added
slog.DiscardLogger()
, which redirects logs toio.Discard
. (#228 #229) 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
:
func TestSomething(t *testing.T) {
opts := goyave.Options{
Logger: slog.New(slog.NewHandler(true, &testutil.LogWriter{t: t})),
}
server := testutil.NewTestServerWithOptions(t, opts)
//...
}
New Contributors
- @SallesCosta made their first contribution in #229
Full Changelog: v5.2.1...v5.3.0