| 1 |
// Copyright 2019 the u-root Authors. All rights reserved |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Package ulogtest implement the Logger interface via a test's testing.TB.Logf. |
| 6 |
package ulogtest |
| 7 |
|
| 8 |
import ( |
| 9 |
"testing" |
| 10 |
) |
| 11 |
|
| 12 |
// Logger is a Logger implementation that logs to testing.TB.Logf. |
| 13 |
type Logger struct { |
| 14 |
TB testing.TB |
| 15 |
} |
| 16 |
|
| 17 |
// Printf formats according to the format specifier and prints to a unit test's log. |
| 18 |
func (tl Logger) Printf(format string, v ...interface{}) { |
| 19 |
tl.TB.Logf(format, v...) |
| 20 |
} |