[VOL-2738]Enable configuration of ectd v3 client options

Change-Id: I75541525b3fd929adf6325f743def45c77e8930a
diff --git a/VERSION b/VERSION
index 0aec50e..3ad0595 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.1.4
+3.1.5
diff --git a/pkg/db/backend.go b/pkg/db/backend.go
index 42574d0..55fda64 100644
--- a/pkg/db/backend.go
+++ b/pkg/db/backend.go
@@ -82,7 +82,7 @@
 	case "consul":
 		return kvstore.NewConsulClient(address, timeout)
 	case "etcd":
-		return kvstore.NewEtcdClient(address, timeout)
+		return kvstore.NewEtcdClient(address, timeout, log.WarnLevel)
 	}
 	return nil, errors.New("unsupported-kv-store")
 }
diff --git a/pkg/db/kvstore/etcdclient.go b/pkg/db/kvstore/etcdclient.go
index d38f0f6..90158bc 100644
--- a/pkg/db/kvstore/etcdclient.go
+++ b/pkg/db/kvstore/etcdclient.go
@@ -39,12 +39,14 @@
 }
 
 // NewEtcdClient returns a new client for the Etcd KV store
-func NewEtcdClient(addr string, timeout int) (*EtcdClient, error) {
+func NewEtcdClient(addr string, timeout int, level log.LogLevel) (*EtcdClient, error) {
 	duration := GetDuration(timeout)
+	logconfig := log.ConstructZapConfig(log.JSON, level, log.Fields{})
 
 	c, err := v3Client.New(v3Client.Config{
 		Endpoints:   []string{addr},
 		DialTimeout: duration,
+		LogConfig:   &logconfig,
 	})
 	if err != nil {
 		logger.Error(err)
diff --git a/pkg/log/log.go b/pkg/log/log.go
index d0169bd..6b7087f 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -232,6 +232,10 @@
 	}
 }
 
+func ConstructZapConfig(outputType string, level LogLevel, fields Fields) zp.Config {
+	return getDefaultConfig(outputType, level, fields)
+}
+
 // SetLogger needs to be invoked before the logger API can be invoked.  This function
 // initialize the default logger (zap's sugaredlogger)
 func SetDefaultLogger(outputType string, level LogLevel, defaultFields Fields) (Logger, error) {
diff --git a/pkg/mocks/etcd/etcd_server_test.go b/pkg/mocks/etcd/etcd_server_test.go
index daf2491..6178568 100644
--- a/pkg/mocks/etcd/etcd_server_test.go
+++ b/pkg/mocks/etcd/etcd_server_test.go
@@ -20,6 +20,7 @@
 	"context"
 	"fmt"
 	"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
+	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/phayes/freeport"
 	"github.com/stretchr/testify/assert"
 	"os"
@@ -43,7 +44,7 @@
 		logger.Fatal("Embedded server failed to start")
 	}
 	clientAddr := fmt.Sprintf("localhost:%d", clientPort)
-	client, err = kvstore.NewEtcdClient(clientAddr, 10)
+	client, err = kvstore.NewEtcdClient(clientAddr, 10, log.WarnLevel)
 	if err != nil || client == nil {
 		etcdServer.Stop()
 		logger.Fatal("Failed to create an Etcd client")
diff --git a/pkg/ponresourcemanager/ponresourcemanager.go b/pkg/ponresourcemanager/ponresourcemanager.go
index 9854b2b..2d388a5 100755
--- a/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/pkg/ponresourcemanager/ponresourcemanager.go
@@ -161,7 +161,7 @@
 	case "consul":
 		return kvstore.NewConsulClient(address, timeout)
 	case "etcd":
-		return kvstore.NewEtcdClient(address, timeout)
+		return kvstore.NewEtcdClient(address, timeout, log.WarnLevel)
 	}
 	return nil, errors.New("unsupported-kv-store")
 }
diff --git a/pkg/techprofile/tech_profile.go b/pkg/techprofile/tech_profile.go
index 4473389..316bd57 100644
--- a/pkg/techprofile/tech_profile.go
+++ b/pkg/techprofile/tech_profile.go
@@ -275,7 +275,7 @@
 	case "consul":
 		return kvstore.NewConsulClient(address, timeout)
 	case "etcd":
-		return kvstore.NewEtcdClient(address, timeout)
+		return kvstore.NewEtcdClient(address, timeout, log.WarnLevel)
 	}
 	return nil, errors.New("unsupported-kv-store")
 }