#1783·perkeep

cleanup: test: make TLog use tb.Cleanup

Author: bradfitzCreated Dec 31, 2025Updated Dec 31, 2025
LabelsEasy

This func could now use https://pkg.go.dev/testing#T.Cleanup instead of returning a restore func.

go
package test

// TLog changes the log package's output to log to t and returns a function
// to reset it back to stderr.
func TLog(t testing.TB) func() {
	log.SetOutput(twriter{t: t})
	return func() {
		log.SetOutput(os.Stderr)
	}