libpldmresponder: 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: I7dc5c308a8cd76573995e07d01d1a6037bca31ba
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/libpldmresponder/platform_numeric_effecter.hpp b/libpldmresponder/platform_numeric_effecter.hpp
index 44b5aab..1cad4a4 100644
--- a/libpldmresponder/platform_numeric_effecter.hpp
+++ b/libpldmresponder/platform_numeric_effecter.hpp
@@ -223,7 +223,7 @@
     }
     else
     {
-        error("Wrong field effecterDataSize...");
+        error("Unknown Effecter Size {SIZE}", "SIZE", effecterDataSize);
         return {PLDM_ERROR, {}};
     }
 }
@@ -295,7 +295,8 @@
 
     if (effecterValueLength != effecterValueArrayLength)
     {
-        error("effecter data size is incorrect.");
+        error("Incorrect effecter data size {SIZE}", "SIZE",
+              effecterValueLength);
         return PLDM_ERROR_INVALID_DATA;
     }
 
@@ -321,17 +322,17 @@
         catch (const std::exception& e)
         {
             error(
-                "Error setting property, ERROR={ERR_EXCEP} PROPERTY={DBUS_PROP} INTERFACE={DBUS_INTF} PATH={DBUS_OBJ_PATH}",
-                "ERR_EXCEP", e.what(), "DBUS_PROP", dbusMapping.propertyName,
-                "DBUS_INTF", dbusMapping.interface, "DBUS_OBJ_PATH",
-                dbusMapping.objectPath.c_str());
+                "Failed to set property '{PROPERTY}', interface '{INTERFACE}' and path '{PATH}', error - {ERROR}",
+                "PROPERTY", dbusMapping.propertyName, "INTERFACE",
+                dbusMapping.interface, "PATH", dbusMapping.objectPath.c_str(),
+                "ERROR", e);
             return PLDM_ERROR;
         }
     }
     catch (const std::out_of_range& e)
     {
-        error("Unknown effecter ID : {EFFECTER_ID} {ERR_EXCEP}", "EFFECTER_ID",
-              effecterId, "ERR_EXCEP", e.what());
+        error("Unknown effecter ID '{EFFECTERID}', error - {ERROR}",
+              "EFFECTERID", effecterId, "ERROR", e);
         return PLDM_ERROR;
     }
 
@@ -415,7 +416,7 @@
         }
         default:
         {
-            error("Unknown Effecter Size");
+            error("Unknown Effecter Size {SIZE}", "SIZE", effecterDataSize);
             return PLDM_ERROR;
         }
     }
@@ -467,8 +468,7 @@
     }
     else
     {
-        error("Property Type [{PROPERTYTYPE}] not supported", "PROPERTYTYPE",
-              propertyType);
+        error("Property type '{TYPE}' not supported", "TYPE", propertyType);
     }
     return PLDM_ERROR;
 }
@@ -529,8 +529,8 @@
 
     if (!pdr)
     {
-        error("The Numeric Effecter not found EFFECTERID={EFFECTERID}",
-              "EFFECTERID", effecterId);
+        error("Failed to find numeric effecter ID {EFFECTERID}", "EFFECTERID",
+              effecterId);
         return PLDM_PLATFORM_INVALID_EFFECTER_ID;
     }
 
@@ -555,11 +555,11 @@
     catch (const std::exception& e)
     {
         error(
-            "Dbus Mapping or the Dbus query for the Effecter failed for effecter id: {EFFECTER_ID}, {ERR_EXCEP}",
-            "EFFECTER_ID", effecterId, "ERR_EXCEP", e.what());
+            "Failed to do dbus mapping or the dbus query for the effecter ID '{EFFECTERID}', error - {ERROR}",
+            "EFFECTERID", effecterId, "ERROR", e);
         error(
-            "Dbus Details objPath : [{OBJ_PATH}] interface : [{INTF}], property : [{PROPERTY}]",
-            "OBJ_PATH", dbusMapping.objectPath.c_str(), "INTF",
+            "Dbus Details path [{PATH}], interface [{INTERFACE}] and  property [{PROPERTY}]",
+            "PATH", dbusMapping.objectPath.c_str(), "INTERFACE",
             dbusMapping.interface.c_str(), "PROPERTY",
             dbusMapping.propertyName.c_str());
         return PLDM_ERROR;