File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,9 @@ func (l *delegatingLogSink) WithValues(tags ...interface{}) logr.LogSink {
188
188
// provided, instead of the temporary initial one, if this method
189
189
// has not been previously called.
190
190
func (l * delegatingLogSink ) Fulfill (actual logr.LogSink ) {
191
+ if actual == nil {
192
+ actual = NullLogSink {}
193
+ }
191
194
if l .promise != nil {
192
195
l .promise .Fulfill (actual )
193
196
}
Original file line number Diff line number Diff line change @@ -98,6 +98,13 @@ func (f *fakeLogger) Enabled(level int) bool { return true }
98
98
var _ = Describe ("logging" , func () {
99
99
100
100
Describe ("top-level logger" , func () {
101
+ It ("should be able to use logr.Discard" , func () {
102
+ SetLogger (logr .Discard ())
103
+ By ("grabbing a sub-logger and logging" )
104
+ l1 := Log .WithName ("runtimeLog" ).WithValues ("newtag" , "newvalue2" )
105
+ l1 .Info ("test" )
106
+ })
107
+
101
108
It ("hold newly created loggers until a logger is set" , func () {
102
109
By ("grabbing a new sub-logger and logging to it" )
103
110
l1 := Log .WithName ("runtimeLog" ).WithValues ("newtag" , "newvalue1" )
You can’t perform that action at this time.
0 commit comments