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)).
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.
The text was updated successfully, but these errors were encountered:
Line-at-a-time logging is not the same as a Write method (Writes are not guaranteed to be aligned with any useful boundary, certainly not lines). But this is not about Write at all. It's about log.Logger, which is/was #22513. Closing as duplicate.