[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/db/backend_test.go b/pkg/db/backend_test.go
index 6d2fb8a..fdd9071 100644
--- a/pkg/db/backend_test.go
+++ b/pkg/db/backend_test.go
@@ -18,7 +18,6 @@
import (
"context"
- "github.com/opencord/voltha-lib-go/v2/pkg/log"
"github.com/opencord/voltha-lib-go/v2/pkg/mocks"
"github.com/phayes/freeport"
"github.com/stretchr/testify/assert"
@@ -29,10 +28,6 @@
"time"
)
-func init() {
- log.AddPackage(log.JSON, log.FatalLevel, nil)
-}
-
const (
embedEtcdServerHost = "localhost"
defaultTimeout = 1
@@ -48,15 +43,15 @@
var err error
embedEtcdServerPort, err = freeport.GetFreePort()
if err != nil {
- log.Fatal(err)
+ logger.Fatal(err)
}
dummyEtcdServerPort, 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 := mocks.StartEtcdServer(mocks.MKConfig("voltha.db.test", embedEtcdServerPort, peerPort, "voltha.lib.db", "error"))
res := m.Run()