File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 6
6
"log"
7
7
8
8
"github.com/go-logr/logr"
9
- tlogr "github.com/go-logr/logr/testing"
10
9
"github.com/go-logr/zapr"
11
10
"go.uber.org/zap"
12
11
)
@@ -45,7 +44,7 @@ func SetLogger(l logr.Logger) {
45
44
// to another logr.Logger. You *must* call SetLogger to
46
45
// get any actual logging.
47
46
var Log = & DelegatingLogger {
48
- Logger : tlogr. NullLogger {},
47
+ Logger : NullLogger {},
49
48
promise : & loggerPromise {},
50
49
}
51
50
Original file line number Diff line number Diff line change
1
+ package log
2
+
3
+ import (
4
+ "github.com/go-logr/logr"
5
+ )
6
+
7
+ // NB: this is the same as the null logger logr/testing,
8
+ // but avoids accidentally adding the testing flags to
9
+ // all binaries.
10
+
11
+ // NullLogger is a logr.Logger that does nothing.
12
+ type NullLogger struct {}
13
+
14
+ var _ logr.Logger = NullLogger {}
15
+
16
+ // Info implements logr.InfoLogger
17
+ func (NullLogger ) Info (_ string , _ ... interface {}) {
18
+ // Do nothing.
19
+ }
20
+
21
+ // Enabled implements logr.InfoLogger
22
+ func (NullLogger ) Enabled () bool {
23
+ return false
24
+ }
25
+
26
+ // Error implements logr.Logger
27
+ func (NullLogger ) Error (_ error , _ string , _ ... interface {}) {
28
+ // Do nothing.
29
+ }
30
+
31
+ // V implements logr.Logger
32
+ func (log NullLogger ) V (_ int ) logr.InfoLogger {
33
+ return log
34
+ }
35
+
36
+ // WithName implements logr.Logger
37
+ func (log NullLogger ) WithName (_ string ) logr.Logger {
38
+ return log
39
+ }
40
+
41
+ // WithValues implements logr.Logger
42
+ func (log NullLogger ) WithValues (_ ... interface {}) logr.Logger {
43
+ return log
44
+ }
You can’t perform that action at this time.
0 commit comments