pldm: Remove unnecessary type casting in logs
This commit removes the unnecessary type casting of values of the
journal logs based on supported types mentioned in LG2 documentation
[1].
Testing: Verified the debug traces to correct.
'''
For Instance:
Earlier -
error(”TYPE = {TYPE} “, “TYPE”, static_cast<unsigned>(PLDM_STATE_EFFECTER_PDR));
Journal trace -
May 27 08:16:51 p10bmc pldmd[931]: TYPE = 11
After Correction -
error(”TYPE = {TYPE}“, “TYPE”, PLDM_STATE_EFFECTER_PDR);
Journal trace -
May 27 08:16:51 p10bmc pldmd[931]: TYPE = Enum(11)
'''
[1]: https://github.com/openbmc/phosphor-logging/blob/master/docs/structured-logging.md#lg2
Change-Id: Ia649ecd4ecbb73c421f7844885f58a6835805719
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/requester/handler.hpp b/requester/handler.hpp
index cefeb78..20da26c 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -148,8 +148,7 @@
{
info(
"Instance ID expiry for EID '{EID}' using InstanceID '{INSTANCEID}'",
- "EID", (unsigned)key.eid, "INSTANCEID",
- (unsigned)key.instanceId);
+ "EID", key.eid, "INSTANCEID", key.instanceId);
auto& [request, responseHandler,
timerInstance] = this->handlers[key];
request->stop();
@@ -158,7 +157,7 @@
{
error(
"Failed to stop the instance ID expiry timer, response code '{RC}'",
- "RC", static_cast<int>(rc));
+ "RC", rc);
}
// Call response handler with an empty response to indicate no
// response
@@ -259,7 +258,7 @@
{
error(
"Register request for EID '{EID}' is using InstanceID '{INSTANCEID}'",
- "EID", (unsigned)eid, "INSTANCEID", (unsigned)instanceId);
+ "EID", eid, "INSTANCEID", instanceId);
return PLDM_ERROR;
}
@@ -372,7 +371,7 @@
{
error(
"Failed to stop the instance ID expiry timer, response code '{RC}'",
- "RC", static_cast<int>(rc));
+ "RC", 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 0d63ad4..2780281 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -79,7 +79,7 @@
{
info(
"Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
- "NETWORK", networkId, "EID", unsigned(eid));
+ "NETWORK", networkId, "EID", eid);
mctpInfos.emplace_back(
MctpInfo(eid, emptyUUID, "", networkId));
}
@@ -135,7 +135,7 @@
{
info(
"Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
- "NETWORK", networkId, "EID", unsigned(eid));
+ "NETWORK", networkId, "EID", eid);
mctpInfos.emplace_back(
MctpInfo(eid, emptyUUID, "", networkId));
}
@@ -170,8 +170,7 @@
for (const auto& mctpInfo : removedInfos)
{
info("Removing Endpoint networkId '{NETWORK}' and EID '{EID}'",
- "NETWORK", std::get<3>(mctpInfo), "EID",
- unsigned(std::get<0>(mctpInfo)));
+ "NETWORK", std::get<3>(mctpInfo), "EID", 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 ff17886..0ba6172 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -90,7 +90,7 @@
if (rc)
{
error("Failed to stop the request timer, response code '{RC}'",
- "RC", static_cast<int>(rc));
+ "RC", rc);
}
}
@@ -197,7 +197,7 @@
{
error(
"Failed to send pldmTransport message, response code '{RC}' and error - {ERROR}",
- "RC", static_cast<int>(rc), "ERROR", errno);
+ "RC", rc, "ERROR", errno);
return PLDM_ERROR;
}
return PLDM_SUCCESS;