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/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;