common & fw-update: 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: I1481c025b6dc6a9200a13de38a4fe55b81bb25ea
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 20bca0c..738b4af 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -48,10 +48,11 @@
sizeof(struct pldm_request_update_req) + compImgSetVerStrInfo.length);
if (rc)
{
- updateManager->instanceIdDb.free(eid, instanceId);
- error("encode_request_update_req failed, EID = {EID}, RC = {RC}", "EID",
- unsigned(eid), "RC", rc);
// Handle error scenario
+ updateManager->instanceIdDb.free(eid, instanceId);
+ error(
+ "Failed to encode request update request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
rc = updateManager->handler.registerRequest(
@@ -59,9 +60,10 @@
std::move(std::bind_front(&DeviceUpdater::requestUpdate, this)));
if (rc)
{
- error("Failed to send RequestUpdate request, EID = {EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
// Handle error scenario
+ error(
+ "Failed to send request update for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
}
@@ -71,8 +73,8 @@
if (response == nullptr || !respMsgLen)
{
// Handle error scenario
- error("No response received for RequestUpdate, EID = {EID}", "EID",
- unsigned(eid));
+ error("No response received for request update for endpoint ID '{EID}'",
+ "EID", unsigned(eid));
return;
}
@@ -84,14 +86,15 @@
&fdMetaDataLen, &fdWillSendPkgData);
if (rc)
{
- error("Decoding RequestUpdate response failed, EID = {EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode request update response for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
return;
}
if (completionCode)
{
error(
- "RequestUpdate response failed with error completion code, EID = {EID}, CC = {CC}",
+ "Failure in request update response for endpoint ID '{EID}', completion code '{CC}'",
"EID", unsigned(eid), "CC", unsigned(completionCode));
return;
}
@@ -147,6 +150,9 @@
else
{
// Handle error scenario
+ error(
+ "Failed to find component classification '{CLASSIFICATION}' and identifier '{IDENTIFIER}'",
+ "CLASSIFICATION", compClassification, "IDENTIFIER", compIdentifier);
}
// ComponentComparisonStamp
CompComparisonStamp compComparisonStamp = std::get<static_cast<size_t>(
@@ -170,10 +176,11 @@
sizeof(pldm_pass_component_table_req) + compVerStrInfo.length);
if (rc)
{
- updateManager->instanceIdDb.free(eid, instanceId);
- error("encode_pass_component_table_req failed, EID = {EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
// Handle error scenario
+ updateManager->instanceIdDb.free(eid, instanceId);
+ error(
+ "Failed to encode pass component table req for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
rc = updateManager->handler.registerRequest(
@@ -182,10 +189,10 @@
std::move(std::bind_front(&DeviceUpdater::passCompTable, this)));
if (rc)
{
- error(
- "Failed to send PassComponentTable request, EID = {EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
// Handle error scenario
+ error(
+ "Failed to send pass component table request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
}
@@ -195,8 +202,9 @@
if (response == nullptr || !respMsgLen)
{
// Handle error scenario
- error("No response received for PassComponentTable, EID = {EID}", "EID",
- unsigned(eid));
+ error(
+ "No response received for pass component table for endpoint ID '{EID}'",
+ "EID", unsigned(eid));
return;
}
@@ -211,7 +219,7 @@
{
// Handle error scenario
error(
- "Decoding PassComponentTable response failed, EID={EID}, RC = {RC}",
+ "Failed to decode pass component table response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
return;
}
@@ -219,7 +227,7 @@
{
// Handle error scenario
error(
- "PassComponentTable response failed with error completion code, EID = {EID}, CC = {CC}",
+ "Failed to pass component table response for endpoint ID '{EID}', completion code '{CC}'",
"EID", unsigned(eid), "CC", unsigned(completionCode));
return;
}
@@ -271,6 +279,9 @@
else
{
// Handle error scenario
+ error(
+ "Failed to find component classification '{CLASSIFICATION}' and identifier '{IDENTIFIER}'",
+ "CLASSIFICATION", compClassification, "IDENTIFIER", compIdentifier);
}
// UpdateOptionFlags
@@ -297,10 +308,11 @@
sizeof(pldm_update_component_req) + compVerStrInfo.length);
if (rc)
{
- updateManager->instanceIdDb.free(eid, instanceId);
- error("encode_update_component_req failed, EID={EID}, RC = {RC}", "EID",
- unsigned(eid), "RC", rc);
// Handle error scenario
+ updateManager->instanceIdDb.free(eid, instanceId);
+ error(
+ "Failed to encode update component req for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
rc = updateManager->handler.registerRequest(
@@ -308,9 +320,10 @@
std::move(std::bind_front(&DeviceUpdater::updateComponent, this)));
if (rc)
{
- error("Failed to send UpdateComponent request, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
// Handle error scenario
+ error(
+ "Failed to send update request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
}
@@ -320,8 +333,9 @@
if (response == nullptr || !respMsgLen)
{
// Handle error scenario
- error("No response received for updateComponent, EID={EID}", "EID",
- unsigned(eid));
+ error(
+ "No response received for update component with endpoint ID {EID}",
+ "EID", unsigned(eid));
return;
}
@@ -337,14 +351,15 @@
&timeBeforeReqFWData);
if (rc)
{
- error("Decoding UpdateComponent response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode update request response for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
return;
}
if (completionCode)
{
error(
- "UpdateComponent response failed with error completion code, EID = {EID}, CC = {CC}",
+ "Failed to update request response for endpoint ID '{EID}', completion code '{CC}'",
"EID", unsigned(eid), "CC", unsigned(completionCode));
return;
}
@@ -363,7 +378,7 @@
if (rc)
{
error(
- "Decoding RequestFirmwareData request failed, EID={EID}, RC = {RC}",
+ "Failed to decode request firmware date request for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
rc = encode_request_firmware_data_resp(
request->hdr.instance_id, PLDM_ERROR_INVALID_DATA, responseMsg,
@@ -371,7 +386,7 @@
if (rc)
{
error(
- "Encoding RequestFirmwareData response failed, EID = {EID}, RC = {RC}",
+ "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -382,8 +397,8 @@
const auto& comp = compImageInfos[applicableComponents[componentIndex]];
auto compOffset = std::get<5>(comp);
auto compSize = std::get<6>(comp);
- error("offset = {OFFSET}, length = {LEN}", "OFFSET", unsigned(offset),
- "LEN", unsigned(length));
+ info("Decoded fw request data at offset '{OFFSET}' and length '{LENGTH}' ",
+ "OFFSET", unsigned(offset), "LENGTH", unsigned(length));
if (length < PLDM_FWUP_BASELINE_TRANSFER_SIZE || length > maxTransferSize)
{
rc = encode_request_firmware_data_resp(
@@ -392,7 +407,7 @@
if (rc)
{
error(
- "Encoding RequestFirmwareData response failed, EID={EID}, RC = {RC}",
+ "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -406,7 +421,7 @@
if (rc)
{
error(
- "Encoding RequestFirmwareData response failed, EID={EID}, RC = {RC}",
+ "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -431,7 +446,7 @@
if (rc)
{
error(
- "Encoding RequestFirmwareData response failed, EID={EID}, RC = {RC}",
+ "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
return response;
}
@@ -451,15 +466,16 @@
&transferResult);
if (rc)
{
- error("Decoding TransferComplete request failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode TransferComplete request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
rc = encode_transfer_complete_resp(request->hdr.instance_id,
PLDM_ERROR_INVALID_DATA, responseMsg,
sizeof(completionCode));
if (rc)
{
error(
- "Encoding TransferComplete response failed, EID={EID}, RC = {RC}",
+ "Failed to encode TransferComplete response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -473,14 +489,14 @@
if (transferResult == PLDM_FWUP_TRANSFER_SUCCESS)
{
info(
- "Component Transfer complete, EID = {EID}, COMPONENT_VERSION = {COMP_VERS}",
- "EID", unsigned(eid), "COMP_VERS", compVersion);
+ "Component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' transfer complete.",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
}
else
{
error(
- "Transfer of the component failed, EID={EID}, COMPONENT_VERSION = {COMP_VERS}, TRANSFER_RESULT = {TRANS_RES}",
- "EID", unsigned(eid), "COMP_VERS", compVersion, "TRANS_RES",
+ "Failure in transfer of the component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - {RESULT}",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "RESULT",
unsigned(transferResult));
}
@@ -488,8 +504,9 @@
responseMsg, sizeof(completionCode));
if (rc)
{
- error("Encoding TransferComplete response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to encode transfer complete response of endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
return response;
}
@@ -507,15 +524,16 @@
auto rc = decode_verify_complete_req(request, payloadLength, &verifyResult);
if (rc)
{
- error("Decoding VerifyComplete request failed, EID = {EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode verify complete request of endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
rc = encode_verify_complete_resp(request->hdr.instance_id,
PLDM_ERROR_INVALID_DATA, responseMsg,
sizeof(completionCode));
if (rc)
{
error(
- "Encoding VerifyComplete response failed, EID={EID}, RC = {RC}",
+ "Failed to encode verify complete response of endpoint ID '{EID}', response code '{RC}'.",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -529,14 +547,14 @@
if (verifyResult == PLDM_FWUP_VERIFY_SUCCESS)
{
info(
- "Component verification complete, EID={EID}, COMPONENT_VERSION={COMP_VERS}",
- "EID", unsigned(eid), "COMP_VERS", compVersion);
+ "Component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' verification complete.",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
}
else
{
error(
- "Component verification failed, EID={EID}, COMPONENT_VERSION={COMP_VERS}, VERIFY_RESULT={VERIFY_RES}",
- "EID", unsigned(eid), "COMP_VERS", compVersion, "VERIFY_RES",
+ "Failed to verify component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - '{RESULT}'",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "RESULT",
unsigned(verifyResult));
}
@@ -544,8 +562,9 @@
responseMsg, sizeof(completionCode));
if (rc)
{
- error("Encoding VerifyComplete response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to encode verify complete response for endpoint ID '{EID}', response code - {RC}",
+ "EID", unsigned(eid), "RC", rc);
return response;
}
@@ -565,15 +584,16 @@
&compActivationModification);
if (rc)
{
- error("Decoding ApplyComplete request failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode apply complete request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
rc = encode_apply_complete_resp(request->hdr.instance_id,
PLDM_ERROR_INVALID_DATA, responseMsg,
sizeof(completionCode));
if (rc)
{
error(
- "Encoding ApplyComplete response failed, EID={EID}, RC = {RC}",
+ "Failed to encode apply complete response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
return response;
@@ -588,15 +608,15 @@
applyResult == PLDM_FWUP_APPLY_SUCCESS_WITH_ACTIVATION_METHOD)
{
info(
- "Component apply complete, EID = {EID}, COMPONENT_VERSION = {COMP_VERS}",
- "EID", unsigned(eid), "COMP_VERS", compVersion);
+ "Component endpoint ID '{EID}' with '{COMPONENT_VERSION}' apply complete.",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
updateManager->updateActivationProgress();
}
else
{
error(
- "Component apply failed, EID = {EID}, COMPONENT_VERSION = {COMP_VERS}, APPLY_RESULT = {APPLY_RES}",
- "EID", unsigned(eid), "COMP_VERS", compVersion, "APPLY_RES",
+ "Failed to apply component endpoint ID '{EID}' and version '{COMPONENT_VERSION}', error - {ERROR}",
+ "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "ERROR",
unsigned(applyResult));
}
@@ -604,8 +624,9 @@
responseMsg, sizeof(completionCode));
if (rc)
{
- error("Encoding ApplyComplete response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to encode apply complete response for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
return response;
}
@@ -642,8 +663,9 @@
if (rc)
{
updateManager->instanceIdDb.free(eid, instanceId);
- error("encode_activate_firmware_req failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to encode activate firmware req for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
rc = updateManager->handler.registerRequest(
@@ -651,8 +673,9 @@
std::move(std::bind_front(&DeviceUpdater::activateFirmware, this)));
if (rc)
{
- error("Failed to send ActivateFirmware request, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to send activate firmware request for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
}
}
@@ -662,8 +685,9 @@
if (response == nullptr || !respMsgLen)
{
// Handle error scenario
- error("No response received for ActivateFirmware, EID={EID}", "EID",
- unsigned(eid));
+ error(
+ "No response received for activate firmware for endpoint ID '{EID}'",
+ "EID", eid);
return;
}
@@ -675,16 +699,17 @@
if (rc)
{
// Handle error scenario
- error("Decoding ActivateFirmware response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to decode activate firmware response for endpoint ID '{EID}', response code '{RC}'",
+ "EID", eid, "RC", rc);
return;
}
if (completionCode)
{
// Handle error scenario
error(
- "ActivateFirmware response failed with error completion code, EID = {EID}, CC = {CC}",
- "EID", unsigned(eid), "CC", unsigned(completionCode));
+ "Failed to activate firmware response for endpoint ID '{EID}', completion code '{CC}'",
+ "EID", eid, "CC", completionCode);
return;
}
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index f5a797b..b8f86ea 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -29,7 +29,7 @@
{
instanceIdDb.free(eid, instanceId);
error(
- "encode_query_device_identifiers_req failed, EID={EID}, RC = {RC}",
+ "Failed to encode query device identifiers req for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
continue;
}
@@ -42,7 +42,7 @@
if (rc)
{
error(
- "Failed to send QueryDeviceIdentifiers request, EID={EID}, RC = {RC}",
+ "Failed to send query device identifiers request for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
}
@@ -54,8 +54,9 @@
{
if (response == nullptr || !respMsgLen)
{
- error("No response received for QueryDeviceIdentifiers, EID={EID}",
- "EID", unsigned(eid));
+ error(
+ "No response received for query device identifiers for endpoint ID '{EID}'",
+ "EID", unsigned(eid));
return;
}
@@ -70,15 +71,16 @@
if (rc)
{
error(
- "Decoding QueryDeviceIdentifiers response failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ "Failed to decode query device identifiers response for endpoint ID '{EID}' and descriptor count '{DESCRIPTOR_COUNT}', response code '{RC}'",
+ "EID", unsigned(eid), "DESCRIPTOR_COUNT", descriptorCount, "RC",
+ rc);
return;
}
if (completionCode)
{
error(
- "QueryDeviceIdentifiers response failed with error completion code, EID={EID}, CC = {CC}",
+ "Failed to query device identifiers response for endpoint ID '{EID}', completion code '{CC}'",
"EID", unsigned(eid), "CC", unsigned(completionCode));
return;
}
@@ -95,8 +97,9 @@
if (rc)
{
error(
- "Decoding descriptor type, length and value failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ "Failed to decode descriptor type {TYPE}, length {LENGTH} and value for endpoint ID '{EID}', response code '{RC}'",
+ "TYPE", descriptorType, "LENGTH", deviceIdentifiersLen, "EID",
+ unsigned(eid), "RC", rc);
return;
}
@@ -119,7 +122,7 @@
if (rc)
{
error(
- "Decoding Vendor-defined descriptor value failed, EID={EID}, RC = {RC}",
+ "Failed to decode vendor-defined descriptor value for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
return;
}
@@ -159,8 +162,9 @@
if (rc)
{
instanceIdDb.free(eid, instanceId);
- error("encode_get_firmware_parameters_req failed, EID={EID}, RC = {RC}",
- "EID", unsigned(eid), "RC", rc);
+ error(
+ "Failed to encode get firmware parameters req for endpoint ID '{EID}', response code '{RC}'",
+ "EID", unsigned(eid), "RC", rc);
return;
}
@@ -172,7 +176,7 @@
if (rc)
{
error(
- "Failed to send GetFirmwareParameters request, EID={EID}, RC = {RC}",
+ "Failed to send get firmware parameters request for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
}
}
@@ -183,8 +187,9 @@
{
if (response == nullptr || !respMsgLen)
{
- error("No response received for GetFirmwareParameters, EID={EID}",
- "EID", unsigned(eid));
+ error(
+ "No response received for get firmware parameters for endpoint ID '{EID}'",
+ "EID", unsigned(eid));
descriptorMap.erase(eid);
return;
}
@@ -200,7 +205,7 @@
if (rc)
{
error(
- "Decoding GetFirmwareParameters response failed, EID={EID}, RC = {RC}",
+ "Failed to decode get firmware parameters response for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
return;
}
@@ -208,7 +213,7 @@
if (fwParams.completion_code)
{
error(
- "GetFirmwareParameters response failed with error completion code, EID={EID}, CC = {CC}",
+ "Failed to get firmware parameters response for endpoint ID '{EID}', completion code '{CC}'",
"EID", unsigned(eid), "CC", unsigned(fwParams.completion_code));
return;
}
@@ -228,7 +233,7 @@
if (rc)
{
error(
- "Decoding component parameter table entry failed, EID={EID}, RC = {RC}",
+ "Failed to decode component parameter table entry for endpoint ID '{EID}', response code '{RC}'",
"EID", unsigned(eid), "RC", rc);
return;
}
diff --git a/fw-update/package_parser.cpp b/fw-update/package_parser.cpp
index 8454770..e13a8d5 100644
--- a/fw-update/package_parser.cpp
+++ b/fw-update/package_parser.cpp
@@ -41,8 +41,9 @@
&compImageSetVersionStr, &recordDescriptors, &fwDevicePkgData);
if (rc)
{
- error("Decoding firmware device ID record failed, RC={RC}", "RC",
- rc);
+ error(
+ "Failed to decode firmware device ID record, response code '{RC}'",
+ "RC", rc);
throw InternalFailure();
}
@@ -59,7 +60,8 @@
if (rc)
{
error(
- "Decoding descriptor type, length and value failed, RC={RC}",
+ "Failed to decode descriptor type value of type '{TYPE}' and length '{LENGTH}', response code '{RC}'",
+ "TYPE", descriptorType, "LENGTH", recordDescriptors.length,
"RC", rc);
throw InternalFailure();
}
@@ -83,8 +85,9 @@
if (rc)
{
error(
- "Decoding Vendor-defined descriptor value failed, RC={RC}",
- "RC", rc);
+ "Failed to decode vendor-defined descriptor value of type '{TYPE}' and length '{LENGTH}', response code '{RC}'",
+ "TYPE", descriptorType, "LENGTH",
+ recordDescriptors.length, "RC", rc);
throw InternalFailure();
}
@@ -153,8 +156,9 @@
&compImageInfo, &compVersion);
if (rc)
{
- error("Decoding component image information failed, RC={RC}", "RC",
- rc);
+ error(
+ "Failed to decode component image information, response code '{RC}'",
+ "RC", rc);
throw InternalFailure();
}
@@ -199,8 +203,9 @@
auto cmpVersion = std::get<static_cast<size_t>(
ComponentImageInfoPos::CompVersionPos)>(componentImageInfo);
error(
- "Validating the component location offset failed, COMP_VERSION={COMP_VERS}",
- "COMP_VERS", cmpVersion);
+ "Failed to validate the component location offset '{OFFSET}' for version '{COMPONENT_VERSION}' and package size '{SIZE}'",
+ "OFFSET", compLocOffset, "COMPONENT_VERSION", cmpVersion,
+ "SIZE", calcPkgSize);
throw InternalFailure();
}
@@ -210,8 +215,8 @@
if (calcPkgSize != pkgSize)
{
error(
- "Package size does not match calculated package size, PKG_SIZE={PKG_SIZE}, CALC_PKG_SIZE={CAL_PKG_SIZE}",
- "PKG_SIZE", pkgSize, "CAL_PKG_SIZE", calcPkgSize);
+ "Failed to match package size '{PKG_SIZE}' to calculated package size '{CALCULATED_PACKAGE_SIZE}'.",
+ "PKG_SIZE", pkgSize, "CALCULATED_PACKAGE_SIZE", calcPkgSize);
throw InternalFailure();
}
}
@@ -221,15 +226,15 @@
{
if (pkgHeaderSize != pkgHdr.size())
{
- error("Package header size is invalid, PKG_HDR_SIZE={PKG_HDR_SIZE}",
- "PKG_HDR_SIZE", pkgHeaderSize);
+ error("Invalid package header size '{PKG_HDR_SIZE}' ", "PKG_HDR_SIZE",
+ pkgHeaderSize);
throw InternalFailure();
}
size_t offset = sizeof(pldm_package_header_information) + pkgVersion.size();
if (offset + sizeof(DeviceIDRecordCount) >= pkgHeaderSize)
{
- error("Parsing package header failed, PKG_HDR_SIZE={PKG_HDR_SIZE}",
+ error("Failed to parse package header of size '{PKG_HDR_SIZE}'",
"PKG_HDR_SIZE", pkgHeaderSize);
throw InternalFailure();
}
@@ -240,14 +245,13 @@
offset = parseFDIdentificationArea(deviceIdRecCount, pkgHdr, offset);
if (deviceIdRecCount != fwDeviceIDRecords.size())
{
- error(
- "DeviceIDRecordCount entries not found, DEVICE_ID_REC_COUNT={DREC_CNT}",
- "DREC_CNT", deviceIdRecCount);
+ error("Failed to find DeviceIDRecordCount {DREC_CNT} entries",
+ "DREC_CNT", deviceIdRecCount);
throw InternalFailure();
}
if (offset + sizeof(ComponentImageCount) >= pkgHeaderSize)
{
- error("Parsing package header failed, PKG_HDR_SIZE={PKG_HDR_SIZE}",
+ error("Failed to parsing package header of size '{PKG_HDR_SIZE}'",
"PKG_HDR_SIZE", pkgHeaderSize);
throw InternalFailure();
}
@@ -259,15 +263,14 @@
offset = parseCompImageInfoArea(compImageCount, pkgHdr, offset);
if (compImageCount != componentImageInfos.size())
{
- error(
- "ComponentImageCount entries not found, COMP_IMAGE_COUNT={COMP_IMG_CNT}",
- "COMP_IMG_CNT", compImageCount);
+ error("Failed to find ComponentImageCount '{COMP_IMG_CNT}' entries",
+ "COMP_IMG_CNT", compImageCount);
throw InternalFailure();
}
if (offset + sizeof(PackageHeaderChecksum) != pkgHeaderSize)
{
- error("Parsing package header failed, PKG_HDR_SIZE={PKG_HDR_SIZE}",
+ error("Failed to parse package header of size '{PKG_HDR_SIZE}'",
"PKG_HDR_SIZE", pkgHeaderSize);
throw InternalFailure();
}
@@ -279,8 +282,9 @@
if (calcChecksum != checksum)
{
error(
- "Parsing package header failed, CALC_CHECKSUM={CHK_SUM}, PKG_HDR_CHECKSUM={PKG_HDR_CHK_SUM}",
- "CHK_SUM", calcChecksum, "PKG_HDR_CHK_SUM", checksum);
+ "Failed to parse package header for calculated checksum '{CALCULATED_CHECKSUM}' and header checksum '{PACKAGE_HEADER_CHECKSUM}'",
+ "CALCULATED_CHECKSUM", calcChecksum, "PACKAGE_HEADER_CHECKSUM",
+ checksum);
throw InternalFailure();
}
@@ -300,8 +304,9 @@
&pkgHeader, &pkgVersion);
if (rc)
{
- error("Decoding PLDM package header information failed, RC={RC}", "RC",
- rc);
+ error(
+ "Failed to decode PLDM package header information, response code '{RC}'",
+ "RC", rc);
return nullptr;
}
diff --git a/fw-update/update_manager.cpp b/fw-update/update_manager.cpp
index 0e3128e..428613b 100644
--- a/fw-update/update_manager.cpp
+++ b/fw-update/update_manager.cpp
@@ -40,8 +40,8 @@
software::Activation::Activations::Activating)
{
error(
- "Activation of PLDM FW update package already in progress, PACKAGE_VERSION={PKG_VERS}",
- "PKG_VERS", parser->pkgVersion);
+ "Activation of PLDM fw update package for version '{VERSION}' already in progress.",
+ "VERSION", parser->pkgVersion);
std::filesystem::remove(packageFilePath);
return -1;
}
@@ -56,8 +56,8 @@
if (!package.good())
{
error(
- "Opening the PLDM FW update package failed, ERR={ERR}, PACKAGEFILE={PKG_FILE}",
- "ERR", unsigned(errno), "PKG_FILE", packageFilePath.c_str());
+ "Failed to open the PLDM fw update package file '{FILE}', error - {ERROR}.",
+ "ERROR", unsigned(errno), "FILE", packageFilePath.c_str());
package.close();
std::filesystem::remove(packageFilePath);
return -1;
@@ -67,8 +67,9 @@
if (packageSize < sizeof(pldm_package_header_information))
{
error(
- "PLDM FW update package length less than the length of the package header information, PACKAGESIZE={PKG_SIZE}",
- "PKG_SIZE", packageSize);
+ "PLDM fw update package length {SIZE} less than the length of the package header information '{PACKAGE_HEADER_INFO_SIZE}'.",
+ "SIZE", packageSize, "PACKAGE_HEADER_INFO_SIZE",
+ sizeof(pldm_package_header_information));
package.close();
std::filesystem::remove(packageFilePath);
return -1;
@@ -113,7 +114,7 @@
}
catch (const std::exception& e)
{
- error("Invalid PLDM package header: {ERROR}", "ERROR", e);
+ error("Invalid PLDM package header, error - {ERROR}", "ERROR", e);
activation = std::make_unique<Activation>(
pldm::utils::DBusHandler::getBus(), objPath,
software::Activation::Activations::Invalid, this);
@@ -207,7 +208,7 @@
auto dur =
std::chrono::duration<double, std::milli>(endTime - startTime)
.count();
- error("Firmware update time: {DURATION}ms", "DURATION", dur);
+ info("Firmware update time: {DURATION}ms", "DURATION", dur);
activation->activation(software::Activation::Activations::Active);
}
return;