Skip to content

Commit c8f416a

Browse files
authored
Do not import testing in the package context. (#1079)
1 parent 3ea1acd commit c8f416a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

logger/logger.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"slices"
2121
"strings"
2222
"sync"
23-
"testing"
2423
"time"
2524

2625
"github.com/go-logr/logr"
@@ -486,7 +485,12 @@ func (l LogRLogger) WithDeferredValues() (Logger, DeferredFieldResolver) {
486485
return l, zaputil.NoOpDeferrer{}
487486
}
488487

489-
func NewTestLogger(t *testing.T) Logger {
488+
type TestLogger interface {
489+
Logf(format string, args ...any)
490+
Log(args ...any)
491+
}
492+
493+
func NewTestLogger(t TestLogger) Logger {
490494
return LogRLogger(funcr.New(func(prefix, args string) {
491495
if prefix != "" {
492496
t.Logf("%s: %s\n", prefix, args)

0 commit comments

Comments
 (0)