File: logger_test.go

package info (click to toggle)
golang-github-ibm-sarama 1.45.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 2,964 kB
  • sloc: makefile: 35; sh: 19
file content (38 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//go:build !functional

package sarama

import "testing"

// testLogger implements the StdLogger interface and records the text in the
// logs of the given T passed from Test functions.
// and records the text in the error log.
//
// nolint:unused
type testLogger struct {
	t *testing.T
}

// nolint:unused
func (l *testLogger) Print(v ...interface{}) {
	if l.t != nil {
		l.t.Helper()
		l.t.Log(v...)
	}
}

// nolint:unused
func (l *testLogger) Printf(format string, v ...interface{}) {
	if l.t != nil {
		l.t.Helper()
		l.t.Logf(format, v...)
	}
}

// nolint:unused
func (l *testLogger) Println(v ...interface{}) {
	if l.t != nil {
		l.t.Helper()
		l.t.Log(v...)
	}
}