pldmd, requester, softoff & utilities: 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: I230e9e1404db8c92c81e2f872183d691c91ff16c
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/requester/handler.hpp b/requester/handler.hpp
index 5fc5f7b..3b1eca5 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -145,16 +145,19 @@
         auto eid = key.eid;
         if (this->handlers.contains(key))
         {
-            error("The eid:InstanceID {EID}:{IID} is using.", "EID",
-                  (unsigned)key.eid, "IID", (unsigned)key.instanceId);
+            info(
+                "Instance ID expiry for EID '{EID}' using InstanceID '{INSTANCEID}'",
+                "EID", (unsigned)key.eid, "INSTANCEID",
+                (unsigned)key.instanceId);
             auto& [request, responseHandler,
                    timerInstance] = this->handlers[key];
             request->stop();
             auto rc = timerInstance->stop();
             if (rc)
             {
-                error("Failed to stop the instance ID expiry timer. RC = {RC}",
-                      "RC", static_cast<int>(rc));
+                error(
+                    "Failed to stop the instance ID expiry timer, response code '{RC}'",
+                    "RC", static_cast<int>(rc));
             }
             // Call response handler with an empty response to indicate no
             // response
@@ -205,7 +208,9 @@
         if (rc)
         {
             instanceIdDb.free(requestMsg->key.eid, requestMsg->key.instanceId);
-            error("Failure to send the PLDM request message");
+            error(
+                "Failure to send the PLDM request message for polling endpoint queue, response code '{RC}'",
+                "RC", rc);
             endpointMessageQueues[eid]->activeRequest = false;
             return rc;
         }
@@ -219,8 +224,8 @@
         {
             instanceIdDb.free(requestMsg->key.eid, requestMsg->key.instanceId);
             error(
-                "Failed to start the instance ID expiry timer. RC = {ERR_EXCEP}",
-                "ERR_EXCEP", e.what());
+                "Failed to start the instance ID expiry timer, error - {ERROR}",
+                "ERROR", e);
             endpointMessageQueues[eid]->activeRequest = false;
             return PLDM_ERROR;
         }
@@ -251,8 +256,9 @@
 
         if (handlers.contains(key))
         {
-            error("The eid:InstanceID {EID}:{IID} is using.", "EID",
-                  (unsigned)eid, "IID", (unsigned)instanceId);
+            error(
+                "Register request for EID '{EID}' is using InstanceID '{INSTANCEID}'",
+                "EID", (unsigned)eid, "INSTANCEID", (unsigned)instanceId);
             return PLDM_ERROR;
         }
 
@@ -297,8 +303,9 @@
             auto rc = timerInstance->stop();
             if (rc)
             {
-                error("Failed to stop the instance ID expiry timer. RC = {RC}",
-                      "RC", static_cast<int>(rc));
+                error(
+                    "Failed to stop the instance ID expiry timer, response code '{RC}'",
+                    "RC", static_cast<int>(rc));
             }
             responseHandler(eid, response, respMsgLen);
             instanceIdDb.free(key.eid, key.instanceId);
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp
index 0d63cb2..0d63ad4 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -48,8 +48,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        error("getSubtree call failed with, {ERROR} {PATH} {INTERFACE}",
-              "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface);
+        error(
+            "Failed to getSubtree call at path '{PATH}' and interface '{INTERFACE}', error - {ERROR} ",
+            "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface);
         return;
     }
 
@@ -76,8 +77,9 @@
                     if (std::find(types.begin(), types.end(), mctpTypePLDM) !=
                         types.end())
                     {
-                        info("Adding Endpoint networkId={NETWORK} EID={EID}",
-                             "NETWORK", networkId, "EID", unsigned(eid));
+                        info(
+                            "Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
+                            "NETWORK", networkId, "EID", unsigned(eid));
                         mctpInfos.emplace_back(
                             MctpInfo(eid, emptyUUID, "", networkId));
                     }
@@ -86,7 +88,7 @@
             catch (const sdbusplus::exception_t& e)
             {
                 error(
-                    "Error reading MCTP Endpoint property, {ERROR} {SERVICE} {PATH}",
+                    "Error reading MCTP Endpoint property at path '{PATH}' and service '{SERVICE}', error - {ERROR}",
                     "ERROR", e, "SERVICE", service, "PATH", path);
                 return;
             }
@@ -109,8 +111,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        error("Error reading MCTP Endpoint addedInterace message, {ERROR}",
-              "ERROR", e);
+        error(
+            "Error reading MCTP Endpoint added interface message, error - {ERROR}",
+            "ERROR", e);
         return;
     }
 
@@ -130,8 +133,9 @@
                 if (std::find(types.begin(), types.end(), mctpTypePLDM) !=
                     types.end())
                 {
-                    info("Adding Endpoint networkId={NETWORK} EID={EID}",
-                         "NETWORK", networkId, "EID", unsigned(eid));
+                    info(
+                        "Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
+                        "NETWORK", networkId, "EID", unsigned(eid));
                     mctpInfos.emplace_back(
                         MctpInfo(eid, emptyUUID, "", networkId));
                 }
@@ -165,8 +169,9 @@
     }
     for (const auto& mctpInfo : removedInfos)
     {
-        info("Removing Endpoint networkId={NETWORK} EID={EID}", "NETWORK",
-             std::get<3>(mctpInfo), "EID", unsigned(std::get<0>(mctpInfo)));
+        info("Removing Endpoint networkId '{NETWORK}' and  EID '{EID}'",
+             "NETWORK", std::get<3>(mctpInfo), "EID",
+             unsigned(std::get<0>(mctpInfo)));
         existingMctpInfos.erase(std::remove(existingMctpInfos.begin(),
                                             existingMctpInfos.end(), mctpInfo),
                                 existingMctpInfos.end());
diff --git a/requester/request.hpp b/requester/request.hpp
index cb4e026..ff17886 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -75,8 +75,8 @@
         }
         catch (const std::runtime_error& e)
         {
-            error("Failed to start the request timer. RC = {ERR_EXCEP}",
-                  "ERR_EXCEP", e.what());
+            error("Failed to start the request timer, error - {ERROR}", "ERROR",
+                  e);
             return PLDM_ERROR;
         }
 
@@ -89,8 +89,8 @@
         auto rc = timer.stop();
         if (rc)
         {
-            error("Failed to stop the request timer. RC = {RC}", "RC",
-                  static_cast<int>(rc));
+            error("Failed to stop the request timer, response code '{RC}'",
+                  "RC", static_cast<int>(rc));
         }
     }
 
@@ -195,8 +195,9 @@
                                          requestMsg.data(), requestMsg.size());
         if (rc < 0)
         {
-            error("Failed to send PLDM message. RC = {RC}, errno = {ERR}", "RC",
-                  static_cast<int>(rc), "ERR", errno);
+            error(
+                "Failed to send pldmTransport message, response code '{RC}' and error - {ERROR}",
+                "RC", static_cast<int>(rc), "ERROR", errno);
             return PLDM_ERROR;
         }
         return PLDM_SUCCESS;