Package testlog to catch logs while testing
ยง Quick start
$ go get sogvin.com/testlog@latest
in your code
func TestYourthing(t *testing.T) {
buf := testlog.Catch(t)
// do something
got := buf.String()
exp := "some log phrase"
if !strings.Contains(got, exp) {
t.Error(got, " missing expected ", exp)
}
}