VOL-2408 - Refactor / Use voltha-lib-go Logging
Change-Id: I6e7d9eaba49c104cd50bb5692a2ff9733014fac4
diff --git a/openflow/echo.go b/openflow/echo.go
index 8e6c0c5..528f845 100644
--- a/openflow/echo.go
+++ b/openflow/echo.go
@@ -18,13 +18,17 @@
import (
"encoding/json"
+
ofp "github.com/donNewtonAlpha/goloxi/of13"
- "log"
+ "github.com/opencord/ofagent-go/settings"
+ l "github.com/opencord/voltha-lib-go/v2/pkg/log"
)
-func handleEchoRequest(request *ofp.EchoRequest, client *Client) {
- jsonMessage, _ := json.Marshal(request)
- log.Printf("handleEchoRequest called with %s", jsonMessage)
+func handleEchoRequest(request *ofp.EchoRequest, DeviceID string, client *Client) {
+ if settings.GetDebug(DeviceID) {
+ js, _ := json.Marshal(request)
+ logger.Debugw("handleEchoRequest called", l.Fields{"DeviceID": DeviceID, "request": js})
+ }
reply := ofp.NewEchoReply()
reply.SetXid(request.GetXid())
reply.SetVersion(request.GetVersion())