File tree 2 files changed +11
-0
lines changed
2 files changed +11
-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 @@ -286,6 +286,14 @@ var _ = Describe("logging", func() {
286
286
logInfo {msg : "msg 2" },
287
287
))
288
288
})
289
+
290
+ It ("should handle nil sinks" , func () {
291
+ By ("fulfilling once" )
292
+ delegLog .Fulfill (logr .Discard ().GetSink ())
293
+ By ("grabbing a sub-logger and logging" )
294
+ l1 := logr .New (delegLog ).WithName ("nilsink" ).WithValues ("newtag" , "newvalue2" )
295
+ l1 .Info ("test" )
296
+ })
289
297
})
290
298
291
299
Describe ("logger from context" , func () {
You can’t perform that action at this time.
0 commit comments