Logging improvement for VGC-NB
Change-Id: I3ee79fbbe6e5ea4d1caafd117576401bc5071f9e
diff --git a/voltha-go-controller/nbi/bwprofile.go b/voltha-go-controller/nbi/bwprofile.go
index 95e0744..17f3c60 100644
--- a/voltha-go-controller/nbi/bwprofile.go
+++ b/voltha-go-controller/nbi/bwprofile.go
@@ -77,18 +77,20 @@
// Get the payload to process the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"ProfileName": profileName, "Reason": err.Error()})
+ http.Error(w, err.Error(), http.StatusConflict)
return
}
// Unmarshal the request into service configuration structure
req := &BWProfile{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Adding Profile", log.Fields{"ProfileName": profileName, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-add-meter-request", log.Fields{"req": req, "d": d.String()})
+
+ logger.Infow(ctx, "Received-northbound-add-meter-request", log.Fields{"req": req})
metercfg := app.VoltMeter{
Name: profileName,
Cir: req.CommittedInformationRate,
@@ -109,6 +111,8 @@
vars := mux.Vars(r)
profileName := vars["id"]
+ logger.Infow(ctx, "Received-northbound-get-meter-request", log.Fields{"ProfileName": profileName})
+
cfg, ok := app.GetApplication().GetMeterByName(profileName)
if !ok {
logger.Warnw(ctx, "Meter profile does not exist", log.Fields{"Name": profileName})
@@ -128,7 +132,7 @@
}
profileRespJSON, err := json.Marshal(profileResp)
if err != nil {
- logger.Errorw(ctx, "Failed to marshal profile response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Failed to marshal profile response", log.Fields{"ProfileResp": profileResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -136,33 +140,37 @@
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(profileRespJSON)
if err != nil {
- logger.Errorw(ctx, "Failed to write profile response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Failed to write profile response", log.Fields{"ProfileResp": profileResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
+ return
}
+ logger.Debugw(ctx, "Fetching ProfileResp from Profilename", log.Fields{"profileResp": profileResp})
}
// DelProfile to delete meter
func (mh *ProfileHandle) DelProfile(cntx context.Context, w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
profileName := vars["id"]
+ logger.Infow(ctx, "Received-northbound-del-meter-request", log.Fields{"profileName": profileName})
+
// TODO : Change the URL and Mux to fetch meter id from the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"ProfileName": profileName, "Reason": err.Error()})
+ http.Error(w, err.Error(), http.StatusConflict)
return
}
req := &ProfileDelReq{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Deleting Profile", log.Fields{"ProfileName": profileName, "Req": req, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-del-meter-request", log.Fields{"req": req})
meterName := profileName
if err := app.GetApplication().DelMeterProf(cntx, meterName); err != nil {
- logger.Errorw(ctx, "northbound-del-meter-failed", log.Fields{"req": req})
+ logger.Errorw(ctx, "northbound-del-meter-failed", log.Fields{"Req": req, "Error": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
diff --git a/voltha-go-controller/nbi/device_info.go b/voltha-go-controller/nbi/device_info.go
index 3b6bb3a..a59a9c3 100644
--- a/voltha-go-controller/nbi/device_info.go
+++ b/voltha-go-controller/nbi/device_info.go
@@ -55,6 +55,7 @@
func (dh *DeviceInfoHandle) getDeviceInfo(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
+ logger.Infow(ctx, "Received get Device Info from Device Id", log.Fields{"Device ID": id})
va := app.GetApplication()
var deviceID string
@@ -70,7 +71,7 @@
deviceInfoOnSN[serialNumber] = getDeviceFields(string(voltDevice.State))
deviceInfoResp[deviceID] = deviceInfoOnSN
} else {
- logger.Errorw(ctx, "Invalid Device Id", log.Fields{"Device": voltDevice})
+ logger.Warnw(ctx, "Invalid Device Id", log.Fields{"Device": id})
return
}
} else {
@@ -88,7 +89,7 @@
deviceInfoJSON, err := json.Marshal(deviceInfoResp)
if err != nil {
- logger.Errorw(ctx, "Error occurred while marshaling device info response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Error occurred while marshaling device info response", log.Fields{"DeviceInfo": deviceInfoResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -96,7 +97,9 @@
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(deviceInfoJSON)
if err != nil {
- logger.Errorw(ctx, "error in sending device info response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "error in sending device info response", log.Fields{"DeviceInfo": deviceInfoResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
+ return
}
+ logger.Debugw(ctx, "Fetching Device Info from Device Id", log.Fields{"DeviceInfo": deviceInfoResp, "Device ID": id})
}
diff --git a/voltha-go-controller/nbi/dhcp_session.go b/voltha-go-controller/nbi/dhcp_session.go
index beecb56..eba1a1d 100644
--- a/voltha-go-controller/nbi/dhcp_session.go
+++ b/voltha-go-controller/nbi/dhcp_session.go
@@ -97,9 +97,10 @@
mac := vars["mac"]
svlan := vars["svlan"]
cvlan := vars["cvlan"]
-
var dhcpData *DhcpSessionInfo
+ logger.Infow(ctx, "Received get Dhcp Session Info", log.Fields{"DeviceID": id})
+
va := app.GetApplication()
dhcpSessionInfoResp := []*DhcpSessionInfo{}
@@ -109,6 +110,7 @@
// Ignore if UNI port is not UP
if vp.State != app.PortStateUp {
+ logger.Warnw(ctx, "Ignore if UNI port is not UP", log.Fields{"VoltPort State": vp.State, "PortStateUp": app.PortStateUp})
return true
}
@@ -136,7 +138,7 @@
}
if len(id) == 0 {
- logger.Errorw(ctx, "No Device Id Provided for Dhcp session Info", log.Fields{"DeviceID": id})
+ logger.Warnw(ctx, "No Device Id Provided for Dhcp session Info", log.Fields{"DeviceID": id})
return
}
voltDevice := va.GetDevice(id)
@@ -146,7 +148,7 @@
dhcpSessionInfoJSON, err := json.Marshal(dhcpSessionInfoResp)
if err != nil {
- logger.Errorw(ctx, "Error occurred while marshaling dhcp session info response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Error occurred while marshaling dhcp session info response", log.Fields{"DeviceID": id, "DhcpSessionInfoResp": dhcpSessionInfoResp, "Error": err})
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -154,7 +156,9 @@
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(dhcpSessionInfoJSON)
if err != nil {
- logger.Errorw(ctx, "error in sending dhcp session info response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "error in sending dhcp session info response", log.Fields{"DeviceID": id, "DhcpSessionInfo": dhcpSessionInfoResp, "Error": err})
w.WriteHeader(http.StatusInternalServerError)
+ return
}
+ logger.Debugw(ctx, "Fetching Dhcp Session Info", log.Fields{"DhcpSessionInfo": dhcpSessionInfoResp})
}
diff --git a/voltha-go-controller/nbi/flow_hash.go b/voltha-go-controller/nbi/flow_hash.go
index ad1aa42..b1f7e72 100644
--- a/voltha-go-controller/nbi/flow_hash.go
+++ b/voltha-go-controller/nbi/flow_hash.go
@@ -46,16 +46,31 @@
func (fh *FlowHashHandle) PutFlowHash(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
+ logger.Infow(ctx, "Received Put Device flow hash", log.Fields{"DeviceID": id})
- reqBody, _ := ioutil.ReadAll(r.Body)
- flowhash, _ := strconv.ParseUint(string(reqBody), 10, 32)
+ reqBody, readErr := ioutil.ReadAll(r.Body)
+ if readErr != nil {
+ logger.Errorw(ctx, "Failed to read put flowhash request", log.Fields{"DeviceID": id, "Error": readErr.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ flowhash, parseErr := strconv.ParseUint(string(reqBody), 10, 32)
+ if parseErr != nil {
+ logger.Errorw(ctx, "Failed to parse string to uint32", log.Fields{"device": id, "Reason": parseErr.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
if len(id) > 0 {
device, err := cntlr.GetController().GetDevice(id)
if err != nil {
- logger.Errorw(ctx, "Failed to get device", log.Fields{"device": id})
+ logger.Errorw(ctx, "Failed to get device", log.Fields{"device": id, "Error": err.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
return
}
device.SetFlowHash(ctx, uint32(flowhash))
+ logger.Debugw(ctx, "Device flow hash", log.Fields{"Flow hash": flowhash})
}
logger.Debugw(ctx, "flowhash data is ", log.Fields{"vars": vars, "value": string(reqBody)})
diff --git a/voltha-go-controller/nbi/get_device_id_list.go b/voltha-go-controller/nbi/get_device_id_list.go
index b3c6ca4..ab41ebb 100644
--- a/voltha-go-controller/nbi/get_device_id_list.go
+++ b/voltha-go-controller/nbi/get_device_id_list.go
@@ -44,6 +44,7 @@
var deviceID string
var deviceIDListResp []string
+ logger.Info(ctx, "Received get DeviceIDList")
getDeviceIDList := func(key, value interface{}) bool {
voltDevice := value.(*app.VoltDevice)
deviceID = voltDevice.Name
@@ -54,7 +55,7 @@
deviceIDListJSON, err := json.Marshal(deviceIDListResp)
if err != nil {
- logger.Errorw(ctx, "Error occurred while marshaling device id list response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Error occurred while marshaling deviceIDList response", log.Fields{"DeviceIDList": deviceIDListResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -62,7 +63,9 @@
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(deviceIDListJSON)
if err != nil {
- logger.Errorw(ctx, "error in sending deviceIDList response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Error in sending deviceIDList response", log.Fields{"DeviceIDLis": deviceIDListResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
+ return
}
+ logger.Debugw(ctx, "Fetch DeviceIDList response", log.Fields{"DeviceIDList": deviceIDListResp})
}
diff --git a/voltha-go-controller/nbi/igmpproxy.go b/voltha-go-controller/nbi/igmpproxy.go
index 70075ea..d284605 100644
--- a/voltha-go-controller/nbi/igmpproxy.go
+++ b/voltha-go-controller/nbi/igmpproxy.go
@@ -70,18 +70,19 @@
// Get the payload to process the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
return
}
// Unmarshal the request into service configuration structure
req := &IgmpProxy{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Adding Igmp Proxy Info", log.Fields{"req": req, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
+ logger.Infow(ctx, "Received-northbound-add-igmpProxyInfo-request", log.Fields{"req": req})
go iph.addIgmpProxy(cntx, w, req)
}
@@ -103,11 +104,11 @@
config.OltSerialNum = splits[0]
config.MvlanProfileID = "mvlan" + strconv.Itoa(req.OutgoingIgmpVlanID)
- logger.Errorw(ctx, "IgmpProxy", log.Fields{"config": config})
+ logger.Infow(ctx, "northbound-add-igmpProxy-request", log.Fields{"config": config})
if err := app.GetApplication().AddMcastConfig(cntx, config.MvlanProfileID, config.IgmpProfileID,
config.IgmpProxyIP, config.OltSerialNum); err != nil {
- logger.Errorw(ctx, "northbound-add-mcast-config-failed", log.Fields{"config": config, "Error": err})
+ logger.Errorw(ctx, "northbound-add-mcast-config-failed", log.Fields{"config": config, "Error": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
diff --git a/voltha-go-controller/nbi/mvlan.go b/voltha-go-controller/nbi/mvlan.go
index c8eedf1..dc19ad6 100644
--- a/voltha-go-controller/nbi/mvlan.go
+++ b/voltha-go-controller/nbi/mvlan.go
@@ -93,39 +93,37 @@
// Get the payload to process the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
return
}
// Unmarshal the request into service configuration structure
req := &Mvlan{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Adding Mvlan Info", log.Fields{"req": req, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
+ logger.Infow(ctx, "Received-northbound-add-mvlanInfo-request", log.Fields{"req": req})
go iph.addMvlan(cntx, w, req)
}
// DelMvlanInfo to delete igmp proxy info
func (iph *MulticastHandle) DelMvlanInfo(cntx context.Context, w http.ResponseWriter, r *http.Request) {
- logger.Info(ctx, "Inside DelMvlanInfo method")
-
vars := mux.Vars(r)
egressvlan := vars["egressvlan"]
- logger.Infow(ctx, "Inside DelMvlanInfo method", log.Fields{"req": egressvlan})
-
name := "mvlan" + egressvlan
// HTTP response with 202 accepted for service delete request
w.WriteHeader(http.StatusAccepted)
- logger.Infow(ctx, "Inside DelMvlanInfo method", log.Fields{"name": name})
+ logger.Infow(ctx, "Request for DelMvlanInfo for mvlan", log.Fields{"name": name})
err := app.GetApplication().DelMvlanProfile(cntx, name)
if err != nil {
- logger.Errorw(cntx, "Failed to delete Mvlan profile", log.Fields{"Error": err})
+ logger.Errorw(cntx, "Failed to delete Mvlan profile", log.Fields{"name": name, "Error": err.Error()})
+ w.WriteHeader(http.StatusNotFound)
return
}
}
@@ -141,6 +139,8 @@
config.Groups = make(map[string][]string)
config.Groups["default"] = groups
+ logger.Infow(ctx, "northbound-add-mvlan-received", log.Fields{"Config": config})
+
if err := app.GetApplication().AddMvlanProfile(cntx, config.Name, config.Mvlan, config.PonVlan, config.Groups,
config.IsChannelBasedGroup, config.OLTSerialNum,
255, config.Proxy); err != nil {
diff --git a/voltha-go-controller/nbi/netConfig.go b/voltha-go-controller/nbi/netConfig.go
index fd54248..230d689 100644
--- a/voltha-go-controller/nbi/netConfig.go
+++ b/voltha-go-controller/nbi/netConfig.go
@@ -80,18 +80,19 @@
// Get the payload to process the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ w.WriteHeader(http.StatusInternalServerError)
return
}
// Unmarshal the request into Network configuration structure
req := &NetConfig{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Adding Network Config", log.Fields{"req": req, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-network-configuration-request", log.Fields{"req": req, "d": d.String()})
+ logger.Infow(ctx, "Received-northbound-network-configuration-request", log.Fields{"req": req})
//va := app.VoltApplication{}
diff --git a/voltha-go-controller/nbi/subscriber.go b/voltha-go-controller/nbi/subscriber.go
index c9ceaee..bf09450 100644
--- a/voltha-go-controller/nbi/subscriber.go
+++ b/voltha-go-controller/nbi/subscriber.go
@@ -113,18 +113,19 @@
// Get the payload to process the request
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ http.Error(w, err.Error(), http.StatusConflict)
return
}
// Unmarshal the request into service configuration structure
req := &SubscriberDeviceInfo{}
if err := json.Unmarshal(d.Bytes(), req); err != nil {
- logger.Warnw(ctx, "Unmarshal Failed", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Failed to Unmarshal Adding Subscriber", log.Fields{"req": req, "Reason": err.Error()})
http.Error(w, err.Error(), http.StatusConflict)
return
}
- logger.Debugw(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
+ logger.Infow(ctx, "Received-northbound-add-service-request", log.Fields{"req": req})
//vsCfgList := getVoltServiceFromSrvInfo(req)
@@ -135,10 +136,10 @@
//vsCfgList := getVoltServiceFromSrvInfo(srvInfo)
va := app.GetApplication()
if len(srvInfo.UniTagList) == 0 {
- logger.Debugw(ctx, "Received OLT configuration", log.Fields{"req": srvInfo})
+ logger.Infow(ctx, "Received OLT configuration", log.Fields{"req": srvInfo})
err := va.AddDeviceConfig(cntx, srvInfo.ID, srvInfo.HardwareIdentifier, srvInfo.NasID, srvInfo.IPAddress, srvInfo.UplinkPort, srvInfo.NniDhcpTrapVid)
if err != nil {
- logger.Warnw(ctx, "Device config addition failed :", log.Fields{"Reason": err.Error()})
+ logger.Warnw(ctx, "Device config addition failed :", log.Fields{"req": srvInfo, "Reason": err.Error()})
}
return
}
@@ -166,6 +167,8 @@
vs.IgmpEnabled = uniTagInfo.IsIgmpRequired
vs.ServiceType = uniTagInfo.ServiceName
+ logger.Debugw(ctx, "", log.Fields{"ServiceName": vs.Name})
+
if uniTagInfo.ServiceName == app.DpuMgmtTraffic ||
uniTagInfo.ServiceName == app.DpuAncpTraffic ||
uniTagInfo.ServiceName == app.FttbSubscriberTraffic {
@@ -204,6 +207,8 @@
vnetName = vnetName + strconv.FormatUint(uint64(vs.CVlan), 10) + "-"
vnetName = vnetName + strconv.FormatUint(uint64(vs.UniVlan), 10)
+ logger.Debugw(ctx, "", log.Fields{"VnetName": vnetName})
+
vnetcfg := app.VnetConfig{
Name: vnetName,
SVlan: vs.SVlan,
@@ -242,7 +247,7 @@
logger.Errorw(ctx, "AddVnet Failed", log.Fields{"VnetName": vnetName, "Error": err})
}
if err := app.GetApplication().AddService(cntx, vs, nil); err != nil {
- logger.Errorw(ctx, "AddService Failed", log.Fields{"Service": vs.Name, "Error": err})
+ logger.Errorw(ctx, "AddService Failed", log.Fields{"Service": vs.Name, "Error": err.Error()})
}
}
}
@@ -252,11 +257,10 @@
vars := mux.Vars(r)
id := vars["id"]
- logger.Debugw(ctx, "Received-northbound-del-service-request", log.Fields{"req": id})
-
d := new(bytes.Buffer)
if _, err := d.ReadFrom(r.Body); err != nil {
- logger.Warnw(ctx, "Error reading buffer", log.Fields{"Reason": err.Error()})
+ logger.Errorw(ctx, "Error reading buffer", log.Fields{"req id": id, "Reason": err.Error()})
+ w.WriteHeader(http.StatusConflict)
return
}
@@ -281,7 +285,7 @@
}
}
- logger.Warnw(ctx, "northbound-del-service-req", log.Fields{"ServiceName": id})
+ logger.Infow(ctx, "Received northbound-del-service-req", log.Fields{"ServiceName": id})
err := app.GetApplication().DelServiceWithPrefix(cntx, id)
if err != nil {
logger.Warnw(ctx, "northbound-del-service-req failed, Subscriber not exist", log.Fields{"ServiceName": id})
diff --git a/voltha-go-controller/nbi/task_list.go b/voltha-go-controller/nbi/task_list.go
index 2e44b25..7ab4f1b 100644
--- a/voltha-go-controller/nbi/task_list.go
+++ b/voltha-go-controller/nbi/task_list.go
@@ -48,6 +48,7 @@
va := app.GetApplication()
var deviceID string
taskListResp := map[string]map[int]*app.TaskInfo{}
+ logger.Infow(ctx, "Received get TaskList", log.Fields{"DeviceID": id})
if len(id) > 0 {
// If Get for single Device
@@ -57,7 +58,7 @@
taskList := va.GetTaskList(deviceID)
taskListResp[deviceID] = taskList
} else {
- logger.Errorw(ctx, "Invalid Device Id", log.Fields{"Device": voltDevice})
+ logger.Warnw(ctx, "Invalid Device Id", log.Fields{"Device": id})
return
}
} else {
@@ -74,7 +75,7 @@
taskListJSON, err := json.Marshal(taskListResp)
if err != nil {
- logger.Errorw(ctx, "Error occurred while marshaling task list response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "Error occurred while marshaling task list response", log.Fields{"TaskList": taskListResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -82,7 +83,9 @@
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(taskListJSON)
if err != nil {
- logger.Errorw(ctx, "error in sending task list response", log.Fields{"Error": err})
+ logger.Errorw(ctx, "error in sending task list response", log.Fields{"TaskList": taskListResp, "Error": err.Error()})
w.WriteHeader(http.StatusInternalServerError)
+ return
}
+ logger.Debugw(ctx, "Fetching TaskListResp for device id", log.Fields{"TaskListResp": taskListResp})
}