test: add NewLogger func

Change-Id: I38cee8fd2e2670088acc1332430aca9725cef13f
This commit is contained in:
Brad Fitzpatrick 2014-10-13 12:47:36 +02:00
parent 749ba38b18
commit 04726cfad1
1 changed files with 5 additions and 0 deletions

View File

@ -65,3 +65,8 @@ func (w *twriter) Write(p []byte) (n int, err error) {
io.CopyN(ioutil.Discard, &w.buf, int64(i)+1)
}
}
// NewLogger returns a logger that logs to t with the given prefix.
func NewLogger(t *testing.T, prefix string) *log.Logger {
return log.New(&twriter{t: t}, prefix, log.LstdFlags)
}