client: Allow setting zap logger in config

This commit is contained in:
Marek Siarkowicz
2021-05-11 16:02:37 +02:00
parent 7ae55cf981
commit 06afe87b34
11 changed files with 26 additions and 26 deletions

View File

@ -73,9 +73,8 @@ func NewEmbedConfig(t testing.TB, name string) *embed.Config {
}
func NewClient(t testing.TB, cfg clientv3.Config) (*clientv3.Client, error) {
client, err := clientv3.New(cfg)
if err != nil {
return nil, err
if cfg.Logger != nil {
cfg.Logger = zaptest.NewLogger(t)
}
return client.WithLogger(zaptest.NewLogger(t)), nil
return clientv3.New(cfg)
}