func (l *Logger) Log(level kgo.LogLevel, msg string, keyvals ...interface{}) {
	fields := make([]zap.Field, 0, len(keyvals)/2)
	for i := 0; i < len(keyvals); i += 2 {
		k, v := keyvals[i], keyvals[i+1]
		fields = append(fields, zap.Any(k.(string), v))
	}
	switch level {
	case kgo.LogLevelDebug:
		l.zl.Debug(msg, fields...)
	case kgo.LogLevelError:
		l.zl.Error(msg, fields...)
	case kgo.LogLevelInfo:
		l.zl.Info(msg, fields...)
	case kgo.LogLevelWarn:
		l.zl.Warn(msg, fields...)
	default:
	}
}
Log is for the kgo.Logger interface.
package kzap
import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"github.com/twmb/franz-go/pkg/kgo"
)
type Logger struct {
	zl *zap.Logger
	levelFn func() kgo.LogLevel
}
func New(zl *zap.Logger, opts ...Opt) *Logger {
	static := kgo.LogLevelError
	switch {
	case zl.Core().Enabled(zapcore.DebugLevel):
		static = kgo.LogLevelDebug
	case zl.Core().Enabled(zapcore.InfoLevel):
		static = kgo.LogLevelInfo
	case zl.Core().Enabled(zapcore.WarnLevel):
		static = kgo.LogLevelWarn
	}
	l := &Logger{
		zl:      zl,
		levelFn: func() kgo.LogLevel { return static },
	}
	for _, opt := range opts {
		opt.apply(l)
	}
	return l
}
type Opt interface {
	apply(*Logger)
}
type opt struct{ fn func(*Logger) }
func (o opt) apply(l *Logger) { o.fn(l) }
func LevelFn(fn func() kgo.LogLevel) Opt {
	return opt{func(l *Logger) { l.levelFn = fn }}
}
func Level(level kgo.LogLevel) Opt {
	return LevelFn(func() kgo.LogLevel { return level })
}
func (l *Logger) Level() kgo.LogLevel {
	return l.levelFn()
}