franz-go icon indicating copy to clipboard operation
franz-go copied to clipboard

Panic when calling `client.OptValue(kgo.WithLogger)` when logger was not set.

Open sgtsquiggs opened this issue 5 months ago • 1 comments

Came across this while writing unit tests to assert I was configuring a client properly.

Wrong assumption made at pkg/kgo/client.go#L239-L243:

case namefn(WithLogger):
	if cfg.logger != nil {
		return []any{cfg.logger.(*wrappedLogger).inner}
	}
	return []any{nil}

The default logger is type *nopLogger pkg/kgo/config.go#L447

sgtsquiggs avatar Jan 05 '24 01:01 sgtsquiggs