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/utilities/requester/set_state_effecter.cpp b/utilities/requester/set_state_effecter.cpp
index 21c332d..19ffd7a 100644
--- a/utilities/requester/set_state_effecter.cpp
+++ b/utilities/requester/set_state_effecter.cpp
@@ -32,8 +32,9 @@
&stateField, request);
if (rc != PLDM_SUCCESS)
{
- error("Message encode failure. PLDM error code = {RC}", "RC", lg2::hex,
- rc);
+ error(
+ "Failed to encode set state effecter states request message, response code '{RC}'",
+ "RC", lg2::hex, rc);
return -1;
}
@@ -48,13 +49,14 @@
if (0 > rc)
{
error(
- "Failed to send message/receive response. RC = {RC}, errno = {ERR}",
- "RC", rc, "ERR", errno);
+ "Failed to send message/receive response, response code '{RC}' and error - {ERROR}",
+ "RC", rc, "ERROR", errno);
return -1;
}
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg);
- info("Done. PLDM RC = {RC}", "RC", lg2::hex,
- static_cast<uint16_t>(response->payload[0]));
+ info(
+ "Done! Got the response for PLDM send receive message request, response code '{RC}'",
+ "RC", lg2::hex, static_cast<uint16_t>(response->payload[0]));
free(responseMsg);
return 0;
diff --git a/utilities/requester/set_state_effecter_async.cpp b/utilities/requester/set_state_effecter_async.cpp
index 80b56c2..0116deb 100644
--- a/utilities/requester/set_state_effecter_async.cpp
+++ b/utilities/requester/set_state_effecter_async.cpp
@@ -39,8 +39,9 @@
&stateField, request);
if (rc != PLDM_SUCCESS)
{
- error("Message encode failure. PLDM error code = {RC}", "RC", lg2::hex,
- rc);
+ error(
+ "Failed to encode set state effecter states request, response code '{RC}'",
+ "RC", lg2::hex, rc);
return -1;
}
@@ -74,8 +75,9 @@
// We've got the response meant for the PLDM request msg that was sent
// out
io.set_enabled(Enabled::Off);
- info("Done. PLDM RC = {RC}", "RC", lg2::hex,
- static_cast<uint16_t>(response->payload[0]));
+ info(
+ "Done! Got the response for PLDM request message, response code '{RC}'",
+ "RC", lg2::hex, static_cast<uint16_t>(response->payload[0]));
free(responseMsg);
exit(EXIT_SUCCESS);
};
@@ -85,8 +87,8 @@
if (0 > rc)
{
error(
- "Failed to send message/receive response. RC = {RC} errno = {ERR}",
- "RC", rc, "ERR", errno);
+ "Failed to send message/receive response, response code '{RC}' and error - {ERROR}",
+ "RC", rc, "ERROR", errno);
return -1;
}