[VOL-2735]Durations should be specified as type time.Duration not int
Change-Id: Ibf1128aea75e9cb53f2bf15949215cf81829580b
diff --git a/VERSION b/VERSION
index 45a1b3f..781dcb0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.2
+1.1.3
diff --git a/go.mod b/go.mod
index 2adfb0f..49a8338 100644
--- a/go.mod
+++ b/go.mod
@@ -10,7 +10,7 @@
github.com/imdario/mergo v0.3.7 // indirect
github.com/jessevdk/go-flags v1.4.0
github.com/jhump/protoreflect v1.5.0
- github.com/opencord/voltha-lib-go/v3 v3.1.5
+ github.com/opencord/voltha-lib-go/v3 v3.1.9
github.com/stretchr/testify v1.4.0
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
diff --git a/go.sum b/go.sum
index ce3c635..87bf6bf 100644
--- a/go.sum
+++ b/go.sum
@@ -229,9 +229,9 @@
github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencord/voltha-lib-go/v3 v3.1.5 h1:Hci6ODHha76i+8jePcfV+W6moCakNA7sFsPSOG7EyIk=
-github.com/opencord/voltha-lib-go/v3 v3.1.5/go.mod h1:ad7C/5/09RcYvGQrxUH4AuOiO8OSQqGmCgEJNEpaag8=
-github.com/opencord/voltha-protos/v3 v3.3.0/go.mod h1:nl1ETp5Iw3avxOaKD8BJlYY5wYI4KeV95aT1pL63nto=
+github.com/opencord/voltha-lib-go/v3 v3.1.9 h1:8Py2yDYDg956Tcv7r/oRdZGMaT1myvnL1en9HoptPRU=
+github.com/opencord/voltha-lib-go/v3 v3.1.9/go.mod h1:26TG6ABl+ppP754YWhhgao9wKNL3SuUf/KztQcJFqrQ=
+github.com/opencord/voltha-protos/v3 v3.3.3/go.mod h1:nl1ETp5Iw3avxOaKD8BJlYY5wYI4KeV95aT1pL63nto=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
diff --git a/internal/pkg/commands/log.go b/internal/pkg/commands/log.go
index d755d86..c745424 100644
--- a/internal/pkg/commands/log.go
+++ b/internal/pkg/commands/log.go
@@ -188,7 +188,7 @@
log.SetAllLogLevel(log.FatalLevel)
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return nil, fmt.Errorf("Unable to create kvstore client %s", err)
}
@@ -196,7 +196,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.KvStoreConfig.Timeout)
defer cancel()
@@ -313,7 +313,7 @@
log.SetAllLogLevel(log.FatalLevel)
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return list
}
@@ -321,7 +321,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.KvStoreConfig.Timeout)
defer cancel()
@@ -499,7 +499,7 @@
return fmt.Errorf(err.Error())
}
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return fmt.Errorf("Unable to create kvstore client %s", err)
}
@@ -507,7 +507,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
var output []LogLevelOutput
@@ -606,7 +606,7 @@
log.SetAllLogLevel(log.FatalLevel)
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return fmt.Errorf("Unable to create kvstore client %s", err)
}
@@ -614,7 +614,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.KvStoreConfig.Timeout)
defer cancel()
@@ -728,7 +728,7 @@
return fmt.Errorf("%s", err)
}
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return fmt.Errorf("Unable to create kvstore client %s", err)
}
@@ -736,7 +736,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
var output []LogLevelOutput
@@ -794,7 +794,7 @@
log.SetAllLogLevel(log.FatalLevel)
- client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()), log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(GlobalConfig.KvStore, GlobalConfig.KvStoreConfig.Timeout, log.FatalLevel)
if err != nil {
return fmt.Errorf("Unable to create kvstore client %s", err)
}
@@ -802,7 +802,7 @@
// Already error checked during option processing
host, port, _ := splitEndpoint(GlobalConfig.KvStore, defaultKvHost, defaultKvPort)
- cm := config.NewConfigManager(client, supportedKvStoreType, host, port, int(GlobalConfig.KvStoreConfig.Timeout.Seconds()))
+ cm := config.NewConfigManager(client, supportedKvStoreType, host, port, GlobalConfig.KvStoreConfig.Timeout)
ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.KvStoreConfig.Timeout)
defer cancel()
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
index 0dafc7a..c0915af 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
@@ -22,6 +22,7 @@
"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
"github.com/opencord/voltha-lib-go/v3/pkg/log"
"strings"
+ "time"
)
const (
@@ -92,7 +93,7 @@
kvStoreEventChan chan *kvstore.Event
}
-func NewConfigManager(kvClient kvstore.Client, kvStoreType, kvStoreHost string, kvStorePort, kvStoreTimeout int) *ConfigManager {
+func NewConfigManager(kvClient kvstore.Client, kvStoreType, kvStoreHost string, kvStorePort int, kvStoreTimeout time.Duration) *ConfigManager {
return &ConfigManager{
KvStoreConfigPrefix: defaultkvStoreConfigPath,
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
index 55fda64..20bacad 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
@@ -21,7 +21,6 @@
"errors"
"fmt"
"strconv"
- "sync"
"time"
"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
@@ -37,12 +36,11 @@
// Backend structure holds details for accessing the kv store
type Backend struct {
- sync.RWMutex
Client kvstore.Client
StoreType string
Host string
Port int
- Timeout int
+ Timeout time.Duration
PathPrefix string
alive bool // Is this backend connection alive?
liveness chan bool // channel to post alive state
@@ -51,7 +49,7 @@
}
// NewBackend creates a new instance of a Backend structure
-func NewBackend(storeType string, host string, port int, timeout int, pathPrefix string) *Backend {
+func NewBackend(storeType string, host string, port int, timeout time.Duration, pathPrefix string) *Backend {
var err error
b := &Backend{
@@ -77,7 +75,7 @@
return b
}
-func (b *Backend) newClient(address string, timeout int) (kvstore.Client, error) {
+func (b *Backend) newClient(address string, timeout time.Duration) (kvstore.Client, error) {
switch b.StoreType {
case "consul":
return kvstore.NewConsulClient(address, timeout)
@@ -188,9 +186,6 @@
// List retrieves one or more items that match the specified key
func (b *Backend) List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error) {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("listing-key", log.Fields{"key": key, "path": formattedPath})
@@ -203,9 +198,6 @@
// Get retrieves an item that matches the specified key
func (b *Backend) Get(ctx context.Context, key string) (*kvstore.KVPair, error) {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("getting-key", log.Fields{"key": key, "path": formattedPath})
@@ -218,9 +210,6 @@
// Put stores an item value under the specifed key
func (b *Backend) Put(ctx context.Context, key string, value interface{}) error {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("putting-key", log.Fields{"key": key, "path": formattedPath})
@@ -233,9 +222,6 @@
// Delete removes an item under the specified key
func (b *Backend) Delete(ctx context.Context, key string) error {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("deleting-key", log.Fields{"key": key, "path": formattedPath})
@@ -248,9 +234,6 @@
// CreateWatch starts watching events for the specified key
func (b *Backend) CreateWatch(ctx context.Context, key string, withPrefix bool) chan *kvstore.Event {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("creating-key-watch", log.Fields{"key": key, "path": formattedPath})
@@ -259,9 +242,6 @@
// DeleteWatch stops watching events for the specified key
func (b *Backend) DeleteWatch(key string, ch chan *kvstore.Event) {
- b.Lock()
- defer b.Unlock()
-
formattedPath := b.makePath(key)
logger.Debugw("deleting-key-watch", log.Fields{"key": key, "path": formattedPath})
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/client.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/client.go
index b9cb1ee..158e626 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/client.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/client.go
@@ -15,11 +15,14 @@
*/
package kvstore
-import "context"
+import (
+ "context"
+ "time"
+)
const (
// Default timeout in seconds when making a kvstore request
- defaultKVGetTimeout = 5
+ defaultKVGetTimeout = 5 * time.Second
// Maximum channel buffer between publisher/subscriber goroutines
maxClientChannelBufferSize = 10
)
@@ -77,12 +80,12 @@
Get(ctx context.Context, key string) (*KVPair, error)
Put(ctx context.Context, key string, value interface{}) error
Delete(ctx context.Context, key string) error
- Reserve(ctx context.Context, key string, value interface{}, ttl int64) (interface{}, error)
+ Reserve(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error)
ReleaseReservation(ctx context.Context, key string) error
ReleaseAllReservations(ctx context.Context) error
RenewReservation(ctx context.Context, key string) error
Watch(ctx context.Context, key string, withPrefix bool) chan *Event
- AcquireLock(ctx context.Context, lockName string, timeout int) error
+ AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error
ReleaseLock(lockName string) error
IsConnectionUp(ctx context.Context) bool // timeout in second
CloseWatch(key string, ch chan *Event)
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/consulclient.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/consulclient.go
index bdf2d10..d2544dd 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/consulclient.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/consulclient.go
@@ -44,13 +44,11 @@
}
// NewConsulClient returns a new client for the Consul KV store
-func NewConsulClient(addr string, timeout int) (*ConsulClient, error) {
-
- duration := GetDuration(timeout)
+func NewConsulClient(addr string, timeout time.Duration) (*ConsulClient, error) {
config := consulapi.DefaultConfig()
config.Address = addr
- config.WaitTime = duration
+ config.WaitTime = timeout
consul, err := consulapi.NewClient(config)
if err != nil {
logger.Error(err)
@@ -76,7 +74,9 @@
deadline, _ := ctx.Deadline()
kv := c.consul.KV()
var queryOptions consulapi.QueryOptions
- queryOptions.WaitTime = GetDuration(deadline.Second())
+ // Substract current time from deadline to get the waitTime duration
+ queryOptions.WaitTime = time.Until(deadline)
+
// For now we ignore meta data
kvps, _, err := kv.List(key, &queryOptions)
if err != nil {
@@ -97,7 +97,9 @@
deadline, _ := ctx.Deadline()
kv := c.consul.KV()
var queryOptions consulapi.QueryOptions
- queryOptions.WaitTime = GetDuration(deadline.Second())
+ // Substract current time from deadline to get the waitTime duration
+ queryOptions.WaitTime = time.Until(deadline)
+
// For now we ignore meta data
kvp, _, err := kv.Get(key, &queryOptions)
if err != nil {
@@ -166,11 +168,11 @@
c.session = nil
}
-func (c *ConsulClient) createSession(ttl int64, retries int) (*consulapi.Session, string, error) {
+func (c *ConsulClient) createSession(ttl time.Duration, retries int) (*consulapi.Session, string, error) {
session := c.consul.Session()
entry := &consulapi.SessionEntry{
Behavior: consulapi.SessionBehaviorDelete,
- TTL: "10s", // strconv.FormatInt(ttl, 10) + "s", // disable ttl
+ TTL: ttl.String(),
}
for {
@@ -218,7 +220,7 @@
// defines how long that reservation is valid. When TTL expires the key is unreserved by the KV store itself.
// If the key is acquired then the value returned will be the value passed in. If the key is already acquired
// then the value assigned to that key will be returned.
-func (c *ConsulClient) Reserve(ctx context.Context, key string, value interface{}, ttl int64) (interface{}, error) {
+func (c *ConsulClient) Reserve(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error) {
// Validate that we can create a byte array from the value as consul API expects a byte array
var val []byte
@@ -432,10 +434,9 @@
logger.Debugw("start-watching-channel", log.Fields{"key": key, "channel": ch})
defer c.CloseWatch(key, ch)
- duration := GetDuration(defaultKVGetTimeout)
kv := c.consul.KV()
var queryOptions consulapi.QueryOptions
- queryOptions.WaitTime = duration
+ queryOptions.WaitTime = defaultKVGetTimeout
// Get the existing value, if any
previousKVPair, meta, err := kv.Get(key, &queryOptions)
@@ -503,7 +504,7 @@
}
}
-func (c *ConsulClient) AcquireLock(ctx context.Context, lockName string, timeout int) error {
+func (c *ConsulClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {
return nil
}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/etcdclient.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/etcdclient.go
index 90158bc..8d4a462 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/etcdclient.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/etcdclient.go
@@ -20,6 +20,7 @@
"errors"
"fmt"
"sync"
+ "time"
"github.com/opencord/voltha-lib-go/v3/pkg/log"
v3Client "go.etcd.io/etcd/clientv3"
@@ -39,13 +40,12 @@
}
// NewEtcdClient returns a new client for the Etcd KV store
-func NewEtcdClient(addr string, timeout int, level log.LogLevel) (*EtcdClient, error) {
- duration := GetDuration(timeout)
+func NewEtcdClient(addr string, timeout time.Duration, level log.LogLevel) (*EtcdClient, error) {
logconfig := log.ConstructZapConfig(log.JSON, level, log.Fields{})
c, err := v3Client.New(v3Client.Config{
Endpoints: []string{addr},
- DialTimeout: duration,
+ DialTimeout: timeout,
LogConfig: &logconfig,
})
if err != nil {
@@ -162,7 +162,7 @@
// defines how long that reservation is valid. When TTL expires the key is unreserved by the KV store itself.
// If the key is acquired then the value returned will be the value passed in. If the key is already acquired
// then the value assigned to that key will be returned.
-func (c *EtcdClient) Reserve(ctx context.Context, key string, value interface{}, ttl int64) (interface{}, error) {
+func (c *EtcdClient) Reserve(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error) {
// Validate that we can convert value to a string as etcd API expects a string
var val string
var er error
@@ -170,7 +170,7 @@
return nil, fmt.Errorf("unexpected-type%T", value)
}
- resp, err := c.ectdAPI.Grant(ctx, ttl)
+ resp, err := c.ectdAPI.Grant(ctx, int64(ttl.Seconds()))
if err != nil {
logger.Error(err)
return nil, err
@@ -457,7 +457,7 @@
return lock, session
}
-func (c *EtcdClient) AcquireLock(ctx context.Context, lockName string, timeout int) error {
+func (c *EtcdClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {
session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
mu := v3Concurrency.NewMutex(session, "/devicelock_"+lockName)
if err := mu.Lock(context.Background()); err != nil {
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/kvutils.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/kvutils.go
index cf9a95c..64e7d30 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/kvutils.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore/kvutils.go
@@ -15,19 +15,7 @@
*/
package kvstore
-import (
- "fmt"
- "time"
-)
-
-// GetDuration converts a timeout value from int to duration. If the timeout value is
-// either not set of -ve then we default KV timeout (configurable) is used.
-func GetDuration(timeout int) time.Duration {
- if timeout <= 0 {
- return defaultKVGetTimeout * time.Second
- }
- return time.Duration(timeout) * time.Second
-}
+import "fmt"
// ToString converts an interface value to a string. The interface should either be of
// a string type or []byte. Otherwise, an error is returned.
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/log/log.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/log/log.go
index 6b7087f..9e0a0b5 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/log/log.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/log/log.go
@@ -552,7 +552,9 @@
// Debugw logs a message with some additional context. The variadic key-value
// pairs are treated as they are in With.
func (l logger) Debugw(msg string, keysAndValues Fields) {
- l.log.Debugw(msg, serializeMap(keysAndValues)...)
+ if l.V(DebugLevel) {
+ l.log.Debugw(msg, serializeMap(keysAndValues)...)
+ }
}
// Info logs a message at level Info on the standard logger.
@@ -575,7 +577,9 @@
// Infow logs a message with some additional context. The variadic key-value
// pairs are treated as they are in With.
func (l logger) Infow(msg string, keysAndValues Fields) {
- l.log.Infow(msg, serializeMap(keysAndValues)...)
+ if l.V(InfoLevel) {
+ l.log.Infow(msg, serializeMap(keysAndValues)...)
+ }
}
// Warn logs a message at level Warn on the standard logger.
@@ -596,7 +600,9 @@
// Warnw logs a message with some additional context. The variadic key-value
// pairs are treated as they are in With.
func (l logger) Warnw(msg string, keysAndValues Fields) {
- l.log.Warnw(msg, serializeMap(keysAndValues)...)
+ if l.V(WarnLevel) {
+ l.log.Warnw(msg, serializeMap(keysAndValues)...)
+ }
}
// Error logs a message at level Error on the standard logger.
@@ -617,7 +623,9 @@
// Errorw logs a message with some additional context. The variadic key-value
// pairs are treated as they are in With.
func (l logger) Errorw(msg string, keysAndValues Fields) {
- l.log.Errorw(msg, serializeMap(keysAndValues)...)
+ if l.V(ErrorLevel) {
+ l.log.Errorw(msg, serializeMap(keysAndValues)...)
+ }
}
// Fatal logs a message at level Fatal on the standard logger.
@@ -638,7 +646,9 @@
// Fatalw logs a message with some additional context. The variadic key-value
// pairs are treated as they are in With.
func (l logger) Fatalw(msg string, keysAndValues Fields) {
- l.log.Fatalw(msg, serializeMap(keysAndValues)...)
+ if l.V(FatalLevel) {
+ l.log.Fatalw(msg, serializeMap(keysAndValues)...)
+ }
}
// Warning logs a message at level Warn on the standard logger.
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 45eeee3..45d6c4f 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -90,7 +90,7 @@
github.com/modern-go/concurrent
# github.com/modern-go/reflect2 v1.0.1
github.com/modern-go/reflect2
-# github.com/opencord/voltha-lib-go/v3 v3.1.5
+# github.com/opencord/voltha-lib-go/v3 v3.1.9
github.com/opencord/voltha-lib-go/v3/pkg/config
github.com/opencord/voltha-lib-go/v3/pkg/db
github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore