common & fw-update: Improving Logs (lg2)

This commit corrects the severity level of logs and also formats the
message string, fixing the ill-defined message string of the logs as
mentioned in the anti-pattern document [1]. Additionally, based on the
requirement this commit adds more debug information to logs.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#ill-defined-data-structuring-in-lg2-message-strings

Change-Id: I1481c025b6dc6a9200a13de38a4fe55b81bb25ea
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index f5a797b..b8f86ea 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -29,7 +29,7 @@
         {
             instanceIdDb.free(eid, instanceId);
             error(
-                "encode_query_device_identifiers_req failed, EID={EID}, RC = {RC}",
+                "Failed to encode query device identifiers req for endpoint ID '{EID}', response code '{RC}'",
                 "EID", unsigned(eid), "RC", rc);
             continue;
         }
@@ -42,7 +42,7 @@
         if (rc)
         {
             error(
-                "Failed to send QueryDeviceIdentifiers request, EID={EID}, RC = {RC}",
+                "Failed to send query device identifiers request for endpoint ID '{EID}', response code '{RC}'",
                 "EID", unsigned(eid), "RC", rc);
         }
     }
@@ -54,8 +54,9 @@
 {
     if (response == nullptr || !respMsgLen)
     {
-        error("No response received for QueryDeviceIdentifiers, EID={EID}",
-              "EID", unsigned(eid));
+        error(
+            "No response received for query device identifiers for endpoint ID '{EID}'",
+            "EID", unsigned(eid));
         return;
     }
 
@@ -70,15 +71,16 @@
     if (rc)
     {
         error(
-            "Decoding QueryDeviceIdentifiers response failed, EID={EID}, RC = {RC}",
-            "EID", unsigned(eid), "RC", rc);
+            "Failed to decode query device identifiers response for endpoint ID '{EID}' and descriptor count '{DESCRIPTOR_COUNT}', response code '{RC}'",
+            "EID", unsigned(eid), "DESCRIPTOR_COUNT", descriptorCount, "RC",
+            rc);
         return;
     }
 
     if (completionCode)
     {
         error(
-            "QueryDeviceIdentifiers response failed with error completion code, EID={EID}, CC = {CC}",
+            "Failed to query device identifiers response for endpoint ID '{EID}', completion code '{CC}'",
             "EID", unsigned(eid), "CC", unsigned(completionCode));
         return;
     }
@@ -95,8 +97,9 @@
         if (rc)
         {
             error(
-                "Decoding descriptor type, length and value failed, EID={EID}, RC = {RC}",
-                "EID", unsigned(eid), "RC", rc);
+                "Failed to decode descriptor type {TYPE}, length {LENGTH} and value for endpoint ID '{EID}', response code '{RC}'",
+                "TYPE", descriptorType, "LENGTH", deviceIdentifiersLen, "EID",
+                unsigned(eid), "RC", rc);
             return;
         }
 
@@ -119,7 +122,7 @@
             if (rc)
             {
                 error(
-                    "Decoding Vendor-defined descriptor value failed, EID={EID}, RC = {RC}",
+                    "Failed to decode vendor-defined descriptor value for endpoint ID '{EID}', response code '{RC}'",
                     "EID", unsigned(eid), "RC", rc);
                 return;
             }
@@ -159,8 +162,9 @@
     if (rc)
     {
         instanceIdDb.free(eid, instanceId);
-        error("encode_get_firmware_parameters_req failed, EID={EID}, RC = {RC}",
-              "EID", unsigned(eid), "RC", rc);
+        error(
+            "Failed to encode get firmware parameters req for endpoint ID '{EID}', response code '{RC}'",
+            "EID", unsigned(eid), "RC", rc);
         return;
     }
 
@@ -172,7 +176,7 @@
     if (rc)
     {
         error(
-            "Failed to send GetFirmwareParameters request, EID={EID}, RC = {RC}",
+            "Failed to send get firmware parameters request for endpoint ID '{EID}', response code '{RC}'",
             "EID", unsigned(eid), "RC", rc);
     }
 }
@@ -183,8 +187,9 @@
 {
     if (response == nullptr || !respMsgLen)
     {
-        error("No response received for GetFirmwareParameters, EID={EID}",
-              "EID", unsigned(eid));
+        error(
+            "No response received for get firmware parameters for endpoint ID '{EID}'",
+            "EID", unsigned(eid));
         descriptorMap.erase(eid);
         return;
     }
@@ -200,7 +205,7 @@
     if (rc)
     {
         error(
-            "Decoding GetFirmwareParameters response failed, EID={EID}, RC = {RC}",
+            "Failed to decode get firmware parameters response for endpoint ID '{EID}', response code '{RC}'",
             "EID", unsigned(eid), "RC", rc);
         return;
     }
@@ -208,7 +213,7 @@
     if (fwParams.completion_code)
     {
         error(
-            "GetFirmwareParameters response failed with error completion code, EID={EID}, CC = {CC}",
+            "Failed to get firmware parameters response for endpoint ID '{EID}', completion code '{CC}'",
             "EID", unsigned(eid), "CC", unsigned(fwParams.completion_code));
         return;
     }
@@ -228,7 +233,7 @@
         if (rc)
         {
             error(
-                "Decoding component parameter table entry failed, EID={EID}, RC = {RC}",
+                "Failed to decode component parameter table entry for endpoint ID '{EID}', response code '{RC}'",
                 "EID", unsigned(eid), "RC", rc);
             return;
         }