convert chassishandler.cpp to use lg2
Change-Id: Ie01500cecc206ba4d197322ce8544a46bdcf52c5
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index b366b2a..8c7bddc 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -11,7 +11,7 @@
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message/types.hpp>
#include <sdbusplus/server/object.hpp>
@@ -293,7 +293,7 @@
if (payloadSize < skipFirstTwoBytes + sizeof(netConfInitialBytes))
{
- log<level::ERR>("Invalid net config ");
+ lg2::error("Invalid net config");
rc = -1;
return rc;
}
@@ -303,7 +303,7 @@
if (payloadSize < skipFirstTwoBytes + addrSizeOffset + sizeof(addrSize))
{
- log<level::ERR>("Invalid length of address size");
+ lg2::error("Invalid length of address size");
rc = -1;
return rc;
}
@@ -393,8 +393,7 @@
std::vector<uint8_t> msgPayloadBytes(msgLen);
if (data.unpack(msgPayloadBytes) != 0 || !data.fullyUnpacked())
{
- log<level::ERR>(
- "Error in unpacking message of setHostNetworkData");
+ lg2::error("Error in unpacking message of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
@@ -402,8 +401,7 @@
constexpr size_t cookieSize = 4;
if (msgLen < cookieOffset + cookieSize)
{
- log<level::ERR>(
- "Error in cookie getting of setHostNetworkData");
+ lg2::error("Error in cookie getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
if (std::equal(msgPayloadStartingPos + cookieOffset,
@@ -420,28 +418,27 @@
break;
}
- log<level::ERR>("Invalid Cookie");
+ lg2::error("Invalid Cookie");
elog<InternalFailure>();
}
// vesion == 0x00 0x01
if (msgLen < versionOffset + sizeVersion)
{
- log<level::ERR>(
- "Error in version getting of setHostNetworkData");
+ lg2::error("Error in version getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
if (std::equal(msgPayloadStartingPos + versionOffset,
msgPayloadStartingPos + versionOffset + sizeVersion,
(netConfInitialBytes + versionOffset)) != 0)
{
- log<level::ERR>("Invalid Version");
+ lg2::error("Invalid Version");
elog<InternalFailure>();
}
if (msgLen < macOffset + 6)
{
- log<level::ERR>(
+ lg2::error(
"Error in mac address getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
@@ -453,7 +450,7 @@
if (msgLen < addrTypeOffset + sizeof(decltype(addrOrigin)))
{
- log<level::ERR>(
+ lg2::error(
"Error in original address getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
@@ -471,7 +468,7 @@
if (msgLen < addrSizeOffset + sizeof(decltype(addrSize)))
{
- log<level::ERR>(
+ lg2::error(
"Error in address size getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
@@ -484,8 +481,7 @@
uint8_t prefixOffset = ipAddrOffset + addrSize;
if (msgLen < prefixOffset + sizeof(decltype(prefix)))
{
- log<level::ERR>(
- "Error in prefix getting of setHostNetworkData");
+ lg2::error("Error in prefix getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
// std::copy(msgPayloadStartingPos + prefixOffset,
@@ -504,8 +500,7 @@
if (msgLen < ipAddrOffset + addrSize)
{
- log<level::ERR>(
- "Error in IP address getting of setHostNetworkData");
+ lg2::error("Error in IP address getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
ipAddress = getAddrStr(family, msgPayloadStartingPos, ipAddrOffset,
@@ -513,7 +508,7 @@
if (msgLen < gatewayOffset + addrSize)
{
- log<level::ERR>(
+ lg2::error(
"Error in gateway address getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
@@ -549,13 +544,13 @@
ipmi::setDbusProperty(bus, macObjectInfo.second, macObjectInfo.first,
MAC_INTERFACE, "MACAddress", std::string(mac));
- log<level::DEBUG>("Network configuration changed",
- entry("NETWORKCONFIG=%s", hostNetworkConfig.c_str()));
+ lg2::debug("Network configuration changed: {NETWORKCONFIG}",
+ "NETWORKCONFIG", hostNetworkConfig);
}
catch (const sdbusplus::exception_t& e)
{
commit<InternalFailure>();
- log<level::ERR>("Error in ipmiChassisSetSysBootOptions call");
+ lg2::error("Error in ipmiChassisSetSysBootOptions call");
return ipmi::ccUnspecifiedError;
}
@@ -628,8 +623,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>("Failed to fetch Chassis Capability properties",
- entry("ERROR=%s", e.what()));
+ lg2::error("Failed to fetch Chassis Capability properties: {ERROR}",
+ "ERROR", e);
return ipmi::responseUnspecifiedError();
}
@@ -637,62 +632,62 @@
std::get_if<bool>(&properties[chassisIntrusionProp]);
if (chassisIntrusionFlag == nullptr)
{
- log<level::ERR>("Error to get chassis Intrusion flags");
+ lg2::error("Error to get chassis Intrusion flags");
return ipmi::responseUnspecifiedError();
}
bool* chassisFrontPanelFlag =
std::get_if<bool>(&properties[chassisFrontPanelLockoutProp]);
if (chassisFrontPanelFlag == nullptr)
{
- log<level::ERR>("Error to get chassis intrusion flags");
+ lg2::error("Error to get chassis intrusion flags");
return ipmi::responseUnspecifiedError();
}
bool* chassisNMIFlag = std::get_if<bool>(&properties[chassisNMIProp]);
if (chassisNMIFlag == nullptr)
{
- log<level::ERR>("Error to get chassis NMI flags");
+ lg2::error("Error to get chassis NMI flags");
return ipmi::responseUnspecifiedError();
}
bool* chassisPowerInterlockFlag =
std::get_if<bool>(&properties[chassisPowerInterlockProp]);
if (chassisPowerInterlockFlag == nullptr)
{
- log<level::ERR>("Error to get chassis power interlock flags");
+ lg2::error("Error to get chassis power interlock flags");
return ipmi::responseUnspecifiedError();
}
uint8_t* chassisFRUInfoDevAddr =
std::get_if<uint8_t>(&properties[chassisFRUDevAddrProp]);
if (chassisFRUInfoDevAddr == nullptr)
{
- log<level::ERR>("Error to get chassis FRU info device address");
+ lg2::error("Error to get chassis FRU info device address");
return ipmi::responseUnspecifiedError();
}
uint8_t* chassisSDRDevAddr =
std::get_if<uint8_t>(&properties[chassisSDRDevAddrProp]);
if (chassisSDRDevAddr == nullptr)
{
- log<level::ERR>("Error to get chassis SDR device address");
+ lg2::error("Error to get chassis SDR device address");
return ipmi::responseUnspecifiedError();
}
uint8_t* chassisSELDevAddr =
std::get_if<uint8_t>(&properties[chassisSELDevAddrProp]);
if (chassisSELDevAddr == nullptr)
{
- log<level::ERR>("Error to get chassis SEL device address");
+ lg2::error("Error to get chassis SEL device address");
return ipmi::responseUnspecifiedError();
}
uint8_t* chassisSMDevAddr =
std::get_if<uint8_t>(&properties[chassisSMDevAddrProp]);
if (chassisSMDevAddr == nullptr)
{
- log<level::ERR>("Error to get chassis SM device address");
+ lg2::error("Error to get chassis SM device address");
return ipmi::responseUnspecifiedError();
}
uint8_t* chassisBridgeDevAddr =
std::get_if<uint8_t>(&properties[chassisBridgeDevAddrProp]);
if (chassisBridgeDevAddr == nullptr)
{
- log<level::ERR>("Error to get chassis bridge device address");
+ lg2::error("Error to get chassis bridge device address");
return ipmi::responseUnspecifiedError();
}
@@ -731,41 +726,41 @@
// check input data
if (reserved1 != 0)
{
- log<level::ERR>("Unsupported request parameter");
+ lg2::error("Unsupported request parameter");
return ipmi::responseInvalidFieldRequest();
}
if ((fruDeviceAddr & ~chassisCapAddrMask) != 0)
{
- log<level::ERR>("Unsupported request parameter(FRU Addr)",
- entry("REQ=0x%x", fruDeviceAddr));
+ lg2::error("Unsupported request parameter(FRU Addr) for REQ={REQ}",
+ "REQ", lg2::hex, fruDeviceAddr);
return ipmi::responseInvalidFieldRequest();
}
if ((sdrDeviceAddr & ~chassisCapAddrMask) != 0)
{
- log<level::ERR>("Unsupported request parameter(SDR Addr)",
- entry("REQ=0x%x", sdrDeviceAddr));
+ lg2::error("Unsupported request parameter(SDR Addr) for REQ={REQ}",
+ "REQ", lg2::hex, sdrDeviceAddr);
return ipmi::responseInvalidFieldRequest();
}
if ((selDeviceAddr & ~chassisCapAddrMask) != 0)
{
- log<level::ERR>("Unsupported request parameter(SEL Addr)",
- entry("REQ=0x%x", selDeviceAddr));
+ lg2::error("Unsupported request parameter(SEL Addr) for REQ={REQ}",
+ "REQ", lg2::hex, selDeviceAddr);
return ipmi::responseInvalidFieldRequest();
}
if ((smDeviceAddr & ~chassisCapAddrMask) != 0)
{
- log<level::ERR>("Unsupported request parameter(SM Addr)",
- entry("REQ=0x%x", smDeviceAddr));
+ lg2::error("Unsupported request parameter(SM Addr) for REQ={REQ}",
+ "REQ", lg2::hex, smDeviceAddr);
return ipmi::responseInvalidFieldRequest();
}
if ((bridgeDeviceAddr & ~chassisCapAddrMask) != 0)
{
- log<level::ERR>("Unsupported request parameter(Bridge Addr)",
- entry("REQ=0x%x", bridgeDeviceAddr));
+ lg2::error("Unsupported request parameter(Bridge Addr) for REQ={REQ}",
+ "REQ", lg2::hex, bridgeDeviceAddr);
return ipmi::responseInvalidFieldRequest();
}
@@ -805,7 +800,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(e.what());
+ lg2::error("Failed to set chassis capability properties: {ERR}", "ERR",
+ e);
return ipmi::responseUnspecifiedError();
}
return ipmi::responseSuccess();
@@ -837,14 +833,14 @@
}
if (ec)
{
- log<level::ERR>("Failed to initiate transition",
- entry("EXCEPTION=%s, REQUEST=%s", ec.message().c_str(),
- request.c_str()));
+ lg2::error(
+ "Failed to initiate transition for request {REQUEST}: {EXCEPTION}",
+ "REQUEST", request, "EXCEPTION", ec.message());
return -1;
}
- log<level::INFO>(
- "Transition request initiated successfully",
- entry("USERID=%d, REQUEST=%s", ctx->userId, request.c_str()));
+ lg2::info(
+ "Transition request {REQUEST} initiated successfully by user {USERID}",
+ "REQUEST", request, "USERID", ctx->userId);
return 0;
}
@@ -875,9 +871,9 @@
}
if (ec)
{
- log<level::ERR>("Failed to initiate transition",
- entry("EXCEPTION=%s, REQUEST=%s", ec.message().c_str(),
- request.c_str()));
+ lg2::error("Failed to initiate transition {REQUEST}: {EXCEPTION}",
+ "REQUEST", request, "EXCEPTION", ec.message());
+
return -1;
}
@@ -896,8 +892,8 @@
ec = ipmi::getDbusObject(ctx, nmiIntfName, nmiObj);
if (ec)
{
- log<level::ERR>("Failed to find NMI service",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Failed to find NMI service: {ERROR}", "ERROR",
+ ec.message());
return -1;
}
@@ -905,8 +901,7 @@
nmiObj.first, nmiIntfName, "NMI");
if (ec)
{
- log<level::ERR>("NMI call failed",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("NMI call failed: {ERROR}", "ERROR", ec.message());
elog<InternalFailure>();
return -1;
}
@@ -954,10 +949,10 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(
- "Failed to fetch pgood property", entry("ERROR=%s", e.what()),
- entry("PATH=%s", objects.map.at(powerRestoreIntf).front().c_str()),
- entry("INTERFACE=%s", powerRestoreIntf));
+ lg2::error(
+ "Failed to fetch pgood property ({PATH}/{INTERFACE}): {ERROR}",
+ "PATH", objects.map.at(powerRestoreIntf).front(), "INTERFACE",
+ powerRestoreIntf, "ERROR", e);
cache::objectsPtr.reset();
return std::nullopt;
}
@@ -1006,8 +1001,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>("Failed to fetch pgood property",
- entry("ERROR=%s", e.what()));
+ lg2::error("Failed to fetch pgood property: {ERROR}", "ERROR", e);
return std::nullopt;
}
}
@@ -1038,10 +1032,9 @@
}
catch (const std::exception& e)
{
- log<level::ERR>("Failed to fetch PFail property",
- entry("ERROR=%s", e.what()),
- entry("PATH=%s", powerControlObj),
- entry("INTERFACE=%s", powerControlIntf));
+ lg2::error(
+ "Failed to fetch PFail property ({PATH}/{INTERFAC}): {ERROR}",
+ "PATH", powerControlObj, "INTERFACE", powerControlIntf, "ERROR", e);
}
return acFail;
}
@@ -1061,9 +1054,8 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>("Fail to get button Enabled property",
- entry("PATH=%s", buttonPath.c_str()),
- entry("ERROR=%s", e.what()));
+ lg2::error("Fail to get button Enabled property ({PATH}): {ERROR}",
+ "PATH", buttonPath, "ERROR", e);
return std::nullopt;
}
return std::make_optional(buttonDisabled);
@@ -1083,10 +1075,9 @@
}
if (ec)
{
- log<level::ERR>("Fail to set button Enabled property",
- entry("SERVICE=%s", service.c_str()),
- entry("PATH=%s", buttonPath.c_str()),
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error(
+ "Fail to set button Enabled property ({SERVICE}:{PATH}): {ERROR}",
+ "SERVICE", service, "PATH", buttonPath, "ERROR", ec.message());
return false;
}
return true;
@@ -1115,10 +1106,10 @@
return std::make_optional(ret);
}
}
- log<level::ERR>("Fail to get Chassis Intrusion Status property",
- entry("PATH=%s", chassisIntrusionPath),
- entry("INTERFACE=%s", chassisIntrusionInf),
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Fail to get Chassis Intrusion Status property "
+ "({PATH}/{INTERFACE}): {ERROR}",
+ "PATH", chassisIntrusionPath, "INTERFACE", chassisIntrusionInf,
+ "ERROR", ec.message());
return std::nullopt;
}
@@ -1327,10 +1318,10 @@
}
}
- log<level::ERR>("Failed to fetch RestartCause property",
- entry("ERROR=%s", ec.message().c_str()),
- entry("PATH=%s", restartCausePath),
- entry("INTERFACE=%s", restartCauseIntf));
+ lg2::error(
+ "Failed to fetch RestartCause property ({PATH}/{INTERFACE}): {ERROR}",
+ "ERROR", ec.message(), "PATH", restartCausePath, "INTERFACE",
+ restartCauseIntf);
return std::nullopt;
}
@@ -1386,8 +1377,8 @@
default:
{
- log<level::ERR>("Invalid Chassis Control command",
- entry("CMD=0x%X", chassisControl));
+ lg2::error("Invalid Chassis Control command: {CMD}", "CMD",
+ lg2::hex, chassisControl);
return ipmi::responseInvalidFieldRequest();
}
}
@@ -1411,8 +1402,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>("Chassis Identify: Error communicating to mapper.",
- entry("ERROR=%s", e.what()));
+ lg2::error("Chassis Identify: Error communicating to mapper: {ERROR}",
+ "ERROR", e);
elog<InternalFailure>();
}
}
@@ -1431,7 +1422,7 @@
auto msg = std::string("enclosureIdentifyLed(") +
boost::lexical_cast<std::string>(flag) + ")";
- log<level::DEBUG>(msg.c_str());
+ lg2::debug(msg.c_str());
ipmi::setDbusProperty(*getSdBus(), connection, identify_led_object_name,
"xyz.openbmc_project.Led.Group", "Asserted",
@@ -1439,9 +1430,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>("Chassis Identify: Error Setting State On/Off\n",
- entry("LED_STATE=%d", flag),
- entry("ERROR=%s", e.what()));
+ lg2::error("Chassis Identify: Error Setting State {LED_STATE}: {ERROR}",
+ "LED_STATE", flag, "ERROR", e);
elog<InternalFailure>();
}
}
@@ -1577,8 +1567,7 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in BootSource Get",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootSource Get: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1604,8 +1593,7 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in BootSource Set",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootSource Set: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1631,8 +1619,7 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in BootMode Get",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootMode Get: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1656,8 +1643,7 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in BootMode Set",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootMode Set: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1685,8 +1671,7 @@
"BootType", result);
if (ec)
{
- log<level::ERR>("Error in BootType Get",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootType Get: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
type = Type::convertTypesFromString(result);
@@ -1712,8 +1697,7 @@
"BootType", convertForMessage(type));
if (ec)
{
- log<level::ERR>("Error in BootType Set",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in BootType Set: {ERROR}", "ERROR", ec.message());
return ipmi::ccUnspecifiedError;
}
}
@@ -1745,8 +1729,8 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in Boot Override Enable Get",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in Boot Override Enable Get: {ERROR}", "ERROR",
+ ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1770,8 +1754,8 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in Boot Source Override Enable Set",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in Boot Source Override Enable Set: {ERROR}", "ERROR",
+ ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1796,8 +1780,8 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in Boot Override OneTime Get",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in Boot Override OneTime Get: {ERROR}", "ERROR",
+ ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1821,8 +1805,8 @@
return ipmi::ccSuccess;
}
}
- log<level::ERR>("Error in Boot Source Override OneTime Set",
- entry("ERROR=%s", ec.message().c_str()));
+ lg2::error("Error in Boot Source Override OneTime Set: {ERROR}", "ERROR",
+ ec.message());
return ipmi::ccUnspecifiedError;
}
@@ -1985,7 +1969,7 @@
if (ret < 0)
{
response.trailingOk = true;
- log<level::ERR>(
+ lg2::error(
"getHostNetworkData failed for GetSysBootOptions.");
return ipmi::responseUnspecifiedError();
}
@@ -1996,18 +1980,18 @@
}
else
{
- log<level::ERR>(
- "ipmiChassisGetSysBootOptions: Unsupported parameter",
- entry("PARAM=0x%x",
- static_cast<uint8_t>(bootOptionParameter)));
+ lg2::error(
+ "ipmiChassisGetSysBootOptions: Unsupported parameter {PARAM}",
+ "PARAM", lg2::hex,
+ static_cast<uint8_t>(bootOptionParameter));
return ipmi::responseParmNotSupported();
}
}
else
{
- log<level::ERR>(
- "ipmiChassisGetSysBootOptions: Unsupported parameter",
- entry("PARAM=0x%x", static_cast<uint8_t>(bootOptionParameter)));
+ lg2::error(
+ "ipmiChassisGetSysBootOptions: Unsupported parameter {PARAM}",
+ "PARAM", lg2::hex, static_cast<uint8_t>(bootOptionParameter));
return ipmi::responseParmNotSupported();
}
}
@@ -2156,7 +2140,7 @@
(sourceIpmiToDbus.end() == sourceItr))
{
// return error if boot option is not supported
- log<level::ERR>(
+ lg2::error(
"ipmiChassisSetSysBootOptions: Boot option not supported");
return ipmi::responseInvalidFieldRequest();
}
@@ -2165,9 +2149,8 @@
{
objectsPtr.reset();
report<InternalFailure>();
- log<level::ERR>(
- "ipmiChassisSetSysBootOptions: Error in setting Boot "
- "flag parameters");
+ lg2::error("ipmiChassisSetSysBootOptions: Error in setting Boot "
+ "flag parameters");
return ipmi::responseUnspecifiedError();
}
}
@@ -2189,8 +2172,8 @@
}
bootInitiatorAckData &= ~writeMak;
bootInitiatorAckData |= (writeMak & bootInfoAck);
- log<level::INFO>("ipmiChassisSetSysBootOptions: bootInfo parameter set "
- "successfully");
+ lg2::info("ipmiChassisSetSysBootOptions: bootInfo parameter set "
+ "successfully");
data.trailingOk = true;
return ipmi::responseSuccess();
}
@@ -2210,10 +2193,10 @@
}
// store boot flag valid bits clear value
bootFlagValidBitClr = static_cast<uint8_t>(bootFlagValidClr);
- log<level::INFO>(
+ lg2::info(
"ipmiChassisSetSysBootOptions: bootFlagValidBits parameter set "
- "successfully",
- entry("value=0x%x", bootFlagValidBitClr));
+ "successfully to {VALUE}",
+ "VALUE", lg2::hex, bootFlagValidBitClr);
return ipmi::responseSuccess();
}
else
@@ -2227,8 +2210,8 @@
ipmi::Cc ret = setHostNetworkData(data);
if (ret != ipmi::ccSuccess)
{
- log<level::ERR>("ipmiChassisSetSysBootOptions: Error in "
- "setHostNetworkData");
+ lg2::error("ipmiChassisSetSysBootOptions: Error in "
+ "setHostNetworkData");
data.trailingOk = true;
return ipmi::response(ret);
}
@@ -2237,10 +2220,9 @@
}
else
{
- log<level::ERR>(
- "ipmiChassisSetSysBootOptions: Unsupported parameters",
- entry("PARAM=0x%x",
- static_cast<uint8_t>(parameterSelector)));
+ lg2::error(
+ "ipmiChassisSetSysBootOptions: Unsupported param: {PARAM}",
+ "PARAM", lg2::hex, static_cast<uint8_t>(parameterSelector));
data.trailingOk = true;
return ipmi::responseParmNotSupported();
}
@@ -2271,7 +2253,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(e.what());
+ lg2::error("getPOHCounter error: {ERROR}", "ERROR", e);
return ipmi::responseUnspecifiedError();
}
}
@@ -2287,9 +2269,8 @@
if (reserved || (policy > power_policy::noChange))
{
- phosphor::logging::log<level::ERR>(
- "Reserved request parameter",
- entry("REQ=0x%x", static_cast<int>(policy)));
+ lg2::error("Reserved request parameter: {REQ}", "REQ", lg2::hex,
+ static_cast<int>(policy));
return ipmi::responseInvalidFieldRequest();
}
@@ -2328,7 +2309,7 @@
property);
if (ec)
{
- phosphor::logging::log<level::ERR>("Unspecified Error");
+ lg2::error("Unspecified Error");
return ipmi::responseUnspecifiedError();
}
}