github.com/TrenchBoot/u-root@v6.0.1-0.20200623220532-550e36da3258+incompatible/pkg/ulog/ulogtest/log.go (about)

     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  }
    21  
    22  // Print formats according the default formats for v and prints to a unit test's log.
    23  func (tl Logger) Print(v ...interface{}) {
    24  	tl.TB.Log(v...)
    25  }