Problem
Tests that have to create a *log.Logger do not (at least not out of the box) get to take advantage of testing's T.Log and the nice features that come with it.
This implies test writers have to either wrap T.Log up to make it implement io.Writer somehow and pass that into log.New(tlogger, "", 0), or discard their logs all together (e.g., log.New(ioutil.Discard, "", 0)).
Solution
Have testing.T and testing.B implement io.Writer.
This will allow developers to simply create a log.Logger by doing log.New(t, "", 0). It would also be compatible with most other logging libraries.
Problem
Tests that have to create a
*log.Loggerdo not (at least not out of the box) get to take advantage of testing's T.Log and the nice features that come with it.This implies test writers have to either wrap
T.Logup to make it implementio.Writersomehow and pass that intolog.New(tlogger, "", 0), or discard their logs all together (e.g.,log.New(ioutil.Discard, "", 0)).Solution
Have
testing.Tandtesting.Bimplement io.Writer.This will allow developers to simply create a
log.Loggerby doinglog.New(t, "", 0). It would also be compatible with most other logging libraries.