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