Browse Source

functional/rpcpb: make client log less verbose

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
Gyuho Lee 6 years ago
parent
commit
d1c7be24b0
1 changed files with 10 additions and 0 deletions
  1. 10 0
      functional/rpcpb/member.go

+ 10 - 0
functional/rpcpb/member.go

@@ -25,6 +25,7 @@ import (
 	"go.etcd.io/etcd/clientv3"
 	"go.etcd.io/etcd/clientv3/snapshot"
 	pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
+	"go.etcd.io/etcd/pkg/logutil"
 	"go.etcd.io/etcd/pkg/transport"
 
 	"github.com/dustin/go-humanize"
@@ -94,10 +95,19 @@ func (m *Member) CreateEtcdClientConfig(opts ...grpc.DialOption) (cfg *clientv3.
 		}
 	}
 
+	// TODO: make this configurable
+	level := "error"
+	if os.Getenv("ETCD_CLIENT_DEBUG") != "" {
+		level = "debug"
+	}
+	lcfg := logutil.DefaultZapLoggerConfig
+	lcfg.Level = zap.NewAtomicLevelAt(logutil.ConvertToZapLevel(level))
+
 	cfg = &clientv3.Config{
 		Endpoints:   []string{m.EtcdClientEndpoint},
 		DialTimeout: 10 * time.Second,
 		DialOptions: opts,
+		LogConfig:   &lcfg,
 	}
 	if secure {
 		// assume save TLS assets are already stord on disk