[VOL-3187]Pass Context down the execution call hierarchy across ofagent codebase
Change-Id: Ia5f2fa1509beefe0ddc427b83e39d2702782db8f
diff --git a/internal/pkg/ofagent/packetOut.go b/internal/pkg/ofagent/packetOut.go
index ffeafec..d4b6a73 100644
--- a/internal/pkg/ofagent/packetOut.go
+++ b/internal/pkg/ofagent/packetOut.go
@@ -25,14 +25,14 @@
)
func (ofa *OFAgent) streamPacketOut(ctx context.Context) {
- logger.Debug("packet-out-started")
+ logger.Debug(ctx, "packet-out-started")
// If we exit, assume disconnected
defer func() {
ofa.events <- ofaEventVolthaDisconnected
- logger.Debug("packet-out-finished")
+ logger.Debug(ctx, "packet-out-finished")
}()
if ofa.volthaClient == nil {
- logger.Error("no-voltha-connection")
+ logger.Error(ctx, "no-voltha-connection")
return
}
opt := grpc.EmptyCallOption{}
@@ -40,7 +40,7 @@
outClient, err := ofa.volthaClient.Get().StreamPacketsOut(streamCtx, opt)
defer streamDone()
if err != nil {
- logger.Errorw("streamPacketOut Error creating packetout stream ", log.Fields{"error": err})
+ logger.Errorw(ctx, "streamPacketOut Error creating packetout stream ", log.Fields{"error": err})
return
}
top:
@@ -51,14 +51,14 @@
case ofPacketOut := <-ofa.packetOutChannel:
if logger.V(log.DebugLevel) {
js, _ := json.Marshal(ofPacketOut)
- logger.Debugw("streamPacketOut Receive PacketOut from Channel", log.Fields{"PacketOut": js})
+ logger.Debugw(ctx, "streamPacketOut Receive PacketOut from Channel", log.Fields{"PacketOut": js})
}
if err := outClient.Send(ofPacketOut); err != nil {
- logger.Errorw("packet-out-send-error",
+ logger.Errorw(ctx, "packet-out-send-error",
log.Fields{"error": err.Error()})
break top
}
- logger.Debug("packet-out-send")
+ logger.Debug(ctx, "packet-out-send")
}
}
}