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/fru.cpp b/libpldmresponder/fru.cpp
index d9702ff..be8f573 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -154,8 +154,9 @@
     }
     catch (const std::exception& e)
     {
-        error("Failed building FRU table due to inventory lookup: {ERROR}",
-              "ERROR", e);
+        error(
+            "Failed to build FRU table due to inventory lookup, error - {ERROR}",
+            "ERROR", e);
         return;
     }
 
@@ -198,8 +199,8 @@
                 catch (const std::exception& e)
                 {
                     error(
-                        "Config JSONs missing for the item interface type, interface = {INTF}",
-                        "INTF", interface.first);
+                        "Config JSONs missing for the item '{INTERFACE}', error - {ERROR}",
+                        "INTERFACE", interface.first, "ERROR", e);
                     break;
                 }
             }
@@ -211,8 +212,8 @@
     if (rc < 0)
     {
         // pldm_entity_assocation_pdr_add() assert()ed on failure
-        error("Failed to add PLDM entity association PDR: {LIBPLDM_ERROR}",
-              "LIBPLDM_ERROR", rc);
+        error("Failed to add PLDM entity association PDR, response code '{RC}'",
+              "RC", rc);
         throw std::runtime_error("Failed to add PLDM entity association PDR");
     }
 
@@ -244,8 +245,8 @@
     }
     catch (const std::exception& e)
     {
-        error("failed to make a d-bus call Asociation, ERROR= {ERR_EXCEP}",
-              "ERR_EXCEP", e.what());
+        error("Failed to make a d-bus call Asociation, error - {ERROR}",
+              "ERROR", e);
         return {};
     }
     return currentBmcVersion;