[VOL-2471] Update library to use package logger
This commit consists of the following:
1) Add a GetLogLevel() API to make it easier to use specific
logger. There is also the V() API that kind of do something
similar.
2) Add a common.go file to some heavily used packages in order
to dynamically set their log level and also to a set a specific
logger per package.
3) Use a per package logger for some of the heavily used packages
for improved performance.
Change-Id: If22a2c82d87d808f305677a2e793f8064f33291e
diff --git a/pkg/mocks/etcd_server_test.go b/pkg/mocks/etcd_server_test.go
index 0463daa..90a3654 100644
--- a/pkg/mocks/etcd_server_test.go
+++ b/pkg/mocks/etcd_server_test.go
@@ -21,7 +21,6 @@
"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
"github.com/phayes/freeport"
"github.com/stretchr/testify/assert"
- "log"
"os"
"testing"
)
@@ -32,21 +31,21 @@
func setup() {
clientPort, err := freeport.GetFreePort()
if err != nil {
- log.Fatal(err)
+ logger.Fatal(err)
}
peerPort, err := freeport.GetFreePort()
if err != nil {
- log.Fatal(err)
+ logger.Fatal(err)
}
etcdServer = StartEtcdServer(MKConfig("voltha.mock.test", clientPort, peerPort, "voltha.lib.mocks.etcd", "error"))
if etcdServer == nil {
- log.Fatal("Embedded server failed to start")
+ logger.Fatal("Embedded server failed to start")
}
clientAddr := fmt.Sprintf("localhost:%d", clientPort)
client, err = kvstore.NewEtcdClient(clientAddr, 10)
if err != nil || client == nil {
etcdServer.Stop()
- log.Fatal("Failed to create an Etcd client")
+ logger.Fatal("Failed to create an Etcd client")
}
}