[VOL-3424] Switch completely to Context based Logger instance
Change-Id: Iad9665895c9bad6fea5672571cf9776c779dd7ff
diff --git a/rw_core/core/adapter/manager.go b/rw_core/core/adapter/manager.go
index 616a3bb..5b582b5 100644
--- a/rw_core/core/adapter/manager.go
+++ b/rw_core/core/adapter/manager.go
@@ -148,7 +148,7 @@
logger.Debugw(ctx, "adapter-saved-to-KV-Store", log.Fields{"adapterId": adapter.Id, "vendor": adapter.Vendor,
"currentReplica": adapter.CurrentReplica, "totalReplicas": adapter.TotalReplicas, "endpoint": adapter.Endpoint, "replica": adapter.CurrentReplica, "total": adapter.TotalReplicas})
} else {
- log.Warnw("adding-adapter-already-in-KV-store", log.Fields{
+ logger.Warnw(ctx, "adding-adapter-already-in-KV-store", log.Fields{
"adapterName": adapter.Id,
"adapterReplica": adapter.CurrentReplica,
})
@@ -223,7 +223,7 @@
"currentReplica": adapter.CurrentReplica, "totalReplicas": adapter.TotalReplicas, "endpoint": adapter.Endpoint, "deviceTypes": deviceTypes.Items})
if adapter.Type == "" {
- log.Errorw("adapter-not-specifying-type", log.Fields{
+ logger.Errorw(ctx, "adapter-not-specifying-type", log.Fields{
"adapterId": adapter.Id,
"vendor": adapter.Vendor,
"type": adapter.Type,
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 727f64d..7775d47 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -671,7 +671,7 @@
agent.requestQueue.RequestComplete()
if err := agent.deviceMgr.processTransition(log.WithSpanFromContext(context.Background(), ctx), device, previousState); err != nil {
- log.Errorw("failed-process-transition", log.Fields{"deviceId": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
+ logger.Errorw(ctx, "failed-process-transition", log.Fields{"deviceId": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
}
return nil
}
@@ -763,7 +763,7 @@
}
func (agent *Agent) getExtValue(ctx context.Context, pdevice *voltha.Device, cdevice *voltha.Device, valueparam *voltha.ValueSpecifier) (*voltha.ReturnValues, error) {
- log.Debugw("getExtValue", log.Fields{"device-id": agent.deviceID, "onuid": valueparam.Id, "valuetype": valueparam.Value})
+ logger.Debugw(ctx, "getExtValue", log.Fields{"device-id": agent.deviceID, "onuid": valueparam.Id, "valuetype": valueparam.Value})
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return nil, err
}
diff --git a/rw_core/core/device/logical_agent_flow.go b/rw_core/core/device/logical_agent_flow.go
index eb3e880..224b1f4 100644
--- a/rw_core/core/device/logical_agent_flow.go
+++ b/rw_core/core/device/logical_agent_flow.go
@@ -187,7 +187,7 @@
flowHandle, have := agent.flowLoader.Lock(addedFlow.Id)
if !have {
// Not found - do nothing
- log.Debugw("flow-not-found", log.Fields{"added-flow": addedFlow})
+ logger.Debugw(ctx, "flow-not-found", log.Fields{"added-flow": addedFlow})
return nil
}
defer flowHandle.Unlock()
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 148d67a..1e2d2a4 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -1587,7 +1587,7 @@
func (dMgr *Manager) GetExtValue(ctx context.Context, value *voltha.ValueSpecifier) (*voltha.ReturnValues, error) {
log.EnrichSpan(ctx, log.Fields{"device-id": value.Id})
- log.Debugw("getExtValue", log.Fields{"onu-id": value.Id})
+ logger.Debugw(ctx, "getExtValue", log.Fields{"onu-id": value.Id})
cDevice, err := dMgr.getDeviceReadOnly(ctx, value.Id)
if err != nil {
return nil, status.Errorf(codes.Aborted, "%s", err.Error())
@@ -1601,7 +1601,7 @@
if err != nil {
return nil, err
}
- log.Debugw("getExtValue-result", log.Fields{"result": resp})
+ logger.Debugw(ctx, "getExtValue-result", log.Fields{"result": resp})
return resp, nil
}
return nil, status.Errorf(codes.NotFound, "%s", value.Id)
diff --git a/rw_core/core/device/remote/adapter_proxy.go b/rw_core/core/device/remote/adapter_proxy.go
index 3d25a43..e8681c4 100755
--- a/rw_core/core/device/remote/adapter_proxy.go
+++ b/rw_core/core/device/remote/adapter_proxy.go
@@ -429,7 +429,7 @@
}
func (ap *AdapterProxy) GetExtValue(ctx context.Context, pdevice *voltha.Device, cdevice *voltha.Device, id string, valuetype voltha.ValueType_Type) (chan *kafka.RpcResponse, error) {
- log.Debugw("GetExtValue", log.Fields{"device-id": pdevice.Id, "onuid": id})
+ logger.Debugw(ctx, "GetExtValue", log.Fields{"device-id": pdevice.Id, "onuid": id})
rpc := "get_ext_value"
toTopic, err := ap.getAdapterTopic(ctx, pdevice.Id, pdevice.Adapter)
if err != nil {