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/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index 0adba8c..1030c8e 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -135,7 +135,9 @@
header.command = hdrFields.command;
if (PLDM_SUCCESS != pack_pldm_header(&header, responseHdr))
{
- error("Failed adding response header: {ERROR}", "ERROR", e);
+ error(
+ "Failed to add response header for processing Rx, error - {ERROR}",
+ "ERROR", e);
return std::nullopt;
}
response.insert(response.end(), completion_code);
@@ -352,8 +354,9 @@
(*response).size());
if (returnCode != PLDM_REQUESTER_SUCCESS)
{
- warning("Failed to send PLDM response: {RETURN_CODE}",
- "RETURN_CODE", returnCode);
+ warning(
+ "Failed to send pldmTransport message for TID '{TID}', response code '{RETURN_CODE}'",
+ "TID", TID, "RETURN_CODE", returnCode);
}
}
}
@@ -365,13 +368,16 @@
// recovery mechanism for this daemon is to restart, and hence exit
// the event loop, that will cause this daemon to exit with a
// failure code.
- error("io exiting");
+ error(
+ "MCTP daemon closed the socket, IO exiting with response code '{RC}'",
+ "RC", returnCode);
io.get_event().exit(0);
}
else
{
- warning("Failed to receive PLDM request: {RETURN_CODE}",
- "RETURN_CODE", returnCode);
+ warning(
+ "Failed to receive PLDM request for pldmTransport, response code '{RETURN_CODE}'",
+ "RETURN_CODE", returnCode);
}
/* Free requestMsg after using */
free(requestMsg);