mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
client: Allow setting zap logger in config
This commit is contained in:
@@ -47,6 +47,7 @@ func Save(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, dbPath strin
|
||||
if lg == nil {
|
||||
lg = zap.NewExample()
|
||||
}
|
||||
cfg.Logger = lg.Named("client")
|
||||
if len(cfg.Endpoints) != 1 {
|
||||
return fmt.Errorf("snapshot must be requested to one selected node, not multiple %v", cfg.Endpoints)
|
||||
}
|
||||
@@ -56,8 +57,6 @@ func Save(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, dbPath strin
|
||||
}
|
||||
defer cli.Close()
|
||||
|
||||
cli = cli.WithLogger(lg.Named("client"))
|
||||
|
||||
partpath := dbPath + ".part"
|
||||
defer os.RemoveAll(partpath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user