Move to std::format
The OpenBMC project is moving from the fmt project to the built-in
std::format() support.
Update source files and meson files to move to std::format().
Tested:
* Verified builds cleanly in local CI
* Verified all automated tests run successfully
* Verified builds cleanly in bitbake
* Verified an affected phosphor-psu-monitor journal message still works
correctly.
* Verified an affected phosphor-power-sequencer journal message still
works correctly.
Change-Id: I97b63cf9d132e2b6f173afb30953a9083d68133f
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/meson.build b/meson.build
index eef72a3..33eadae 100644
--- a/meson.build
+++ b/meson.build
@@ -67,18 +67,6 @@
pthread = dependency('threads')
stdplus = dependency('stdplus')
boost = dependency('boost')
-fmt = dependency('fmt', required: false)
-if not fmt.found()
- fmt_proj = import('cmake').subproject(
- 'fmt',
- cmake_options: [
- '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
- '-DMASTER_PROJECT=OFF'
- ],
- required: false)
- assert(fmt_proj.found(), 'fmtlib is required')
- fmt = fmt_proj.dependency('fmt')
-endif
libgpiodcxx = dependency('libgpiodcxx',
default_options: ['bindings=cxx'])
diff --git a/phosphor-power-sequencer/src/power_interface.cpp b/phosphor-power-sequencer/src/power_interface.cpp
index d3def79..0838d8f 100644
--- a/phosphor-power-sequencer/src/power_interface.cpp
+++ b/phosphor-power-sequencer/src/power_interface.cpp
@@ -18,13 +18,12 @@
#include "types.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/sdbus.hpp>
#include <sdbusplus/server.hpp>
+#include <format>
#include <string>
#include <tuple>
@@ -50,7 +49,7 @@
auto pwrObj = static_cast<PowerInterface*>(context);
int pgood = pwrObj->getPgood();
log<level::INFO>(
- fmt::format("callbackGetPgood: {}", pgood).c_str());
+ std::format("callbackGetPgood: {}", pgood).c_str());
sdbusplus::message_t(msg).append(pgood);
}
@@ -83,7 +82,7 @@
auto pwrObj = static_cast<PowerInterface*>(context);
int timeout = pwrObj->getPgoodTimeout();
log<level::INFO>(
- fmt::format("callbackGetPgoodTimeout: {}", timeout).c_str());
+ std::format("callbackGetPgoodTimeout: {}", timeout).c_str());
sdbusplus::message_t(msg).append(timeout);
}
@@ -115,7 +114,7 @@
// requested power state change
int pgood = pwrObj->getPgood();
log<level::INFO>(
- fmt::format("callbackGetPowerState: {}", pgood).c_str());
+ std::format("callbackGetPowerState: {}", pgood).c_str());
auto reply = sdbusplus::message_t(msg).new_method_return();
reply.append(pgood);
@@ -152,7 +151,7 @@
int timeout{};
m.read(timeout);
log<level::INFO>(
- fmt::format("callbackSetPgoodTimeout: {}", timeout).c_str());
+ std::format("callbackSetPgoodTimeout: {}", timeout).c_str());
auto pwrObj = static_cast<PowerInterface*>(context);
pwrObj->setPgoodTimeout(timeout);
@@ -186,7 +185,7 @@
auto pwrObj = static_cast<PowerInterface*>(context);
int state = pwrObj->getState();
log<level::INFO>(
- fmt::format("callbackGetState: {}", state).c_str());
+ std::format("callbackGetState: {}", state).c_str());
sdbusplus::message_t(msg).append(state);
}
@@ -224,7 +223,7 @@
"Invalid power state");
}
log<level::INFO>(
- fmt::format("callbackSetPowerState: {}", state).c_str());
+ std::format("callbackSetPowerState: {}", state).c_str());
auto pwrObj = static_cast<PowerInterface*>(context);
pwrObj->setState(state);
@@ -259,7 +258,7 @@
std::string psError{};
m.read(psError);
log<level::INFO>(
- fmt::format("callbackSetPowerSupplyError: {}", psError)
+ std::format("callbackSetPowerSupplyError: {}", psError)
.c_str());
auto pwrObj = static_cast<PowerInterface*>(context);
@@ -298,7 +297,7 @@
void PowerInterface::emitPropertyChangedSignal(const char* property)
{
log<level::INFO>(
- fmt::format("emitPropertyChangedSignal: {}", property).c_str());
+ std::format("emitPropertyChangedSignal: {}", property).c_str());
serverInterface.property_changed(property);
}
diff --git a/phosphor-power-supply/meson.build b/phosphor-power-supply/meson.build
index 35034b3..9b1d423 100644
--- a/phosphor-power-supply/meson.build
+++ b/phosphor-power-supply/meson.build
@@ -10,7 +10,6 @@
'util.cpp',
dependencies: [
cli11_dep,
- fmt,
libgpiodcxx,
nlohmann_json_dep,
phosphor_dbus_interfaces,
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 6ec8115..1f65fb2 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -5,13 +5,12 @@
#include "types.hpp"
#include "util.hpp"
-#include <fmt/format.h>
-
#include <xyz/openbmc_project/Common/Device/error.hpp>
#include <chrono> // sleep_for()
#include <cmath>
#include <cstdint> // uint8_t...
+#include <format>
#include <fstream>
#include <regex>
#include <thread> // sleep_for()
@@ -47,7 +46,7 @@
shortName = findShortName(inventoryPath);
log<level::DEBUG>(
- fmt::format("{} gpioLineName: {}", shortName, gpioLineName).c_str());
+ std::format("{} gpioLineName: {}", shortName, gpioLineName).c_str());
presenceGPIO = createGPIO(gpioLineName);
std::ostringstream ss;
@@ -130,14 +129,14 @@
{
std::this_thread::sleep_for(std::chrono::milliseconds(bindDelay));
log<level::INFO>(
- fmt::format("Binding device driver. path: {} device: {}",
+ std::format("Binding device driver. path: {} device: {}",
path.string(), bindDevice)
.c_str());
}
else
{
log<level::INFO>(
- fmt::format("Unbinding device driver. path: {} device: {}",
+ std::format("Unbinding device driver. path: {} device: {}",
path.string(), bindDevice)
.c_str());
}
@@ -158,7 +157,7 @@
auto err = errno;
log<level::ERR>(
- fmt::format("Failed binding or unbinding device. errno={}", err)
+ std::format("Failed binding or unbinding device. errno={}", err)
.c_str());
}
}
@@ -174,7 +173,7 @@
// Relying on property change or interface added to retry.
// Log an informational trace to the journal.
log<level::INFO>(
- fmt::format("D-Bus property {} access failure exception",
+ std::format("D-Bus property {} access failure exception",
inventoryPath)
.c_str());
}
@@ -198,13 +197,13 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("presenceGPIO read fail: {}", e.what()).c_str());
+ std::format("presenceGPIO read fail: {}", e.what()).c_str());
throw;
}
if (presentOld != present)
{
- log<level::DEBUG>(fmt::format("{} presentOld: {} present: {}",
+ log<level::DEBUG>(std::format("{} presentOld: {} present: {}",
shortName, presentOld, present)
.c_str());
@@ -251,7 +250,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format("{} CML fault: STATUS_WORD = {:#06x}, "
+ std::format("{} CML fault: STATUS_WORD = {:#06x}, "
"STATUS_CML = {:#02x}",
shortName, statusWord, statusCML)
.c_str());
@@ -274,7 +273,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format("{} INPUT fault: STATUS_WORD = {:#06x}, "
+ std::format("{} INPUT fault: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_INPUT = {:#04x}",
shortName, statusWord, statusMFR, statusInput)
@@ -290,7 +289,7 @@
!(statusWord & phosphor::pmbus::status_word::INPUT_FAULT_WARN))
{
log<level::INFO>(
- fmt::format("{} INPUT fault cleared: STATUS_WORD = {:#06x}, "
+ std::format("{} INPUT fault cleared: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_INPUT = {:#04x}",
shortName, statusWord, statusMFR, statusInput)
@@ -308,7 +307,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"{} VOUT_OV_FAULT fault: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_VOUT = {:#02x}",
@@ -334,7 +333,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format("{} IOUT fault: STATUS_WORD = {:#06x}, "
+ std::format("{} IOUT fault: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_IOUT = {:#04x}",
shortName, statusWord, statusMFR, statusIout)
@@ -360,7 +359,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"{} VOUT_UV_FAULT fault: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_VOUT = {:#04x}",
@@ -384,7 +383,7 @@
{
if (statusWord != statusWordOld)
{
- log<level::ERR>(fmt::format("{} FANS fault/warning: "
+ log<level::ERR>(std::format("{} FANS fault/warning: "
"STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_FANS_1_2 = {:#04x}",
@@ -409,7 +408,7 @@
{
if (statusWord != statusWordOld)
{
- log<level::ERR>(fmt::format("{} TEMPERATURE fault/warning: "
+ log<level::ERR>(std::format("{} TEMPERATURE fault/warning: "
"STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_TEMPERATURE = {:#04x}",
@@ -435,7 +434,7 @@
{
if (statusWord != statusWordOld)
{
- log<level::ERR>(fmt::format("{} PGOOD fault: "
+ log<level::ERR>(std::format("{} PGOOD fault: "
"STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}",
shortName, statusWord, statusMFR)
@@ -501,7 +500,7 @@
{
if (statusWord != statusWordOld)
{
- log<level::ERR>(fmt::format("{} MFR fault: "
+ log<level::ERR>(std::format("{} MFR fault: "
"STATUS_WORD = {:#06x} "
"STATUS_MFR_SPECIFIC = {:#04x}",
shortName, statusWord, statusMFR)
@@ -527,7 +526,7 @@
if (statusWord != statusWordOld)
{
log<level::ERR>(
- fmt::format("{} VIN_UV fault: STATUS_WORD = {:#06x}, "
+ std::format("{} VIN_UV fault: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_INPUT = {:#04x}",
shortName, statusWord, statusMFR, statusInput)
@@ -543,7 +542,7 @@
if (vinUVFault != 0)
{
log<level::INFO>(
- fmt::format("{} VIN_UV fault cleared: STATUS_WORD = {:#06x}, "
+ std::format("{} VIN_UV fault cleared: STATUS_WORD = {:#06x}, "
"STATUS_MFR_SPECIFIC = {:#04x}, "
"STATUS_INPUT = {:#04x}",
shortName, statusWord, statusMFR, statusInput)
@@ -617,7 +616,7 @@
{
if (statusWord != statusWordOld)
{
- log<level::INFO>(fmt::format("{} STATUS_WORD = {:#06x}",
+ log<level::INFO>(std::format("{} STATUS_WORD = {:#06x}",
shortName, statusWord)
.c_str());
}
@@ -626,7 +625,7 @@
if (inputFault)
{
log<level::INFO>(
- fmt::format(
+ std::format(
"{} INPUT fault cleared: STATUS_WORD = {:#06x}",
shortName, statusWord)
.c_str());
@@ -635,7 +634,7 @@
if (vinUVFault)
{
log<level::INFO>(
- fmt::format("{} VIN_UV cleared: STATUS_WORD = {:#06x}",
+ std::format("{} VIN_UV cleared: STATUS_WORD = {:#06x}",
shortName, statusWord)
.c_str());
}
@@ -643,7 +642,7 @@
if (pgoodFault > 0)
{
log<level::INFO>(
- fmt::format("{} pgoodFault cleared", shortName)
+ std::format("{} pgoodFault cleared", shortName)
.c_str());
}
@@ -666,7 +665,7 @@
(inputVoltage != in_input::VIN_VOLTAGE_0))
{
log<level::INFO>(
- fmt::format(
+ std::format(
"{} READ_VIN back in range: actualInputVoltageOld = {} "
"actualInputVoltage = {}",
shortName, actualInputVoltageOld, actualInputVoltage)
@@ -676,7 +675,7 @@
else if (vinUVFault && (inputVoltage != in_input::VIN_VOLTAGE_0))
{
log<level::INFO>(
- fmt::format(
+ std::format(
"{} CLEAR_FAULTS: vinUVFault {} actualInputVoltage {}",
shortName, vinUVFault, actualInputVoltage)
.c_str());
@@ -689,7 +688,7 @@
10.0)
{
log<level::INFO>(
- fmt::format(
+ std::format(
"{} actualInputVoltageOld = {} actualInputVoltage = {}",
shortName, actualInputVoltageOld, actualInputVoltage)
.c_str());
@@ -761,7 +760,7 @@
void PowerSupply::clearFaults()
{
log<level::DEBUG>(
- fmt::format("clearFaults() inventoryPath: {}", inventoryPath).c_str());
+ std::format("clearFaults() inventoryPath: {}", inventoryPath).c_str());
faultLogged = false;
// The PMBus device driver does not allow for writing CLEAR_FAULTS
// directly. However, the pmbus hwmon device driver code will send a
@@ -844,7 +843,7 @@
{
present = std::get<bool>(property->second);
- log<level::INFO>(fmt::format("Power Supply {} Present {}",
+ log<level::INFO>(std::format("Power Supply {} Present {}",
inventoryPath, present)
.c_str());
@@ -879,7 +878,7 @@
if (vpdValue.size() != vpdSize)
{
- log<level::INFO>(fmt::format("{} {} resize needed. size: {}", shortName,
+ log<level::INFO>(std::format("{} {} resize needed. size: {}", shortName,
vpdName, vpdValue.size())
.c_str());
vpdValue.resize(vpdSize, ' ');
@@ -929,7 +928,7 @@
ObjectMap object;
#endif
log<level::DEBUG>(
- fmt::format("updateInventory() inventoryPath: {}", inventoryPath)
+ std::format("updateInventory() inventoryPath: {}", inventoryPath)
.c_str());
if (present)
@@ -1054,14 +1053,14 @@
// Read max_power_out, should be direct format
auto maxPowerOutStr = pmbusIntf->readString(MFR_POUT_MAX,
Type::HwmonDeviceDebug);
- log<level::INFO>(fmt::format("{} MFR_POUT_MAX read {}", shortName,
+ log<level::INFO>(std::format("{} MFR_POUT_MAX read {}", shortName,
maxPowerOutStr)
.c_str());
maxPowerOut = std::stod(maxPowerOutStr);
}
catch (const std::exception& e)
{
- log<level::ERR>(fmt::format("{} MFR_POUT_MAX read error: {}",
+ log<level::ERR>(std::format("{} MFR_POUT_MAX read error: {}",
shortName, e.what())
.c_str());
}
@@ -1090,7 +1089,7 @@
}
auto sensorPath =
- fmt::format("/xyz/openbmc_project/sensors/power/ps{}_input_power_peak",
+ std::format("/xyz/openbmc_project/sensors/power/ps{}_input_power_peak",
shortName.back());
peakInputPowerSensor = std::make_unique<PowerSensorObject>(
@@ -1152,7 +1151,7 @@
if (data.size() != recordSize)
{
log<level::DEBUG>(
- fmt::format("Input history command returned {} bytes instead of 5",
+ std::format("Input history command returned {} bytes instead of 5",
data.size())
.c_str());
peakInputPowerSensor->value(std::numeric_limits<double>::quiet_NaN());
@@ -1207,7 +1206,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("{} READ_VIN read error: {}", shortName, e.what())
+ std::format("{} READ_VIN read error: {}", shortName, e.what())
.c_str());
}
}
@@ -1249,7 +1248,7 @@
if (!inputVoltageRatingIface)
{
- auto path = fmt::format(
+ auto path = std::format(
"/xyz/openbmc_project/sensors/voltage/ps{}_input_voltage_rating",
shortName.back());
@@ -1286,7 +1285,7 @@
catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
- fmt::format("Failed getProperty error: {}", e.what()).c_str());
+ std::format("Failed getProperty error: {}", e.what()).c_str());
}
}
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 2832959..32da768 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -4,13 +4,13 @@
#include "utility.hpp"
-#include <fmt/format.h>
#include <sys/types.h>
#include <unistd.h>
#include <xyz/openbmc_project/State/Chassis/server.hpp>
#include <algorithm>
+#include <format>
#include <regex>
#include <set>
@@ -125,7 +125,7 @@
catch (const std::exception& e)
{
log<level::INFO>(
- fmt::format(
+ std::format(
"Failed to get power state, assuming it is off, error {}",
e.what())
.c_str());
@@ -140,7 +140,7 @@
setPowerConfigGPIO();
log<level::INFO>(
- fmt::format("initialize: power on: {}, power fault occurring: {}",
+ std::format("initialize: power on: {}, power fault occurring: {}",
powerOn, powerFaultOccurring)
.c_str());
}
@@ -177,7 +177,7 @@
{
// Interface or properties not found. Let the Interfaces Added callback
// process the information once the interfaces are added to D-Bus.
- log<level::INFO>(fmt::format("No power supplies to monitor").c_str());
+ log<level::INFO>(std::format("No power supplies to monitor").c_str());
}
}
@@ -225,7 +225,7 @@
invpath.push_back(psuname->back());
std::string presline = "";
- log<level::DEBUG>(fmt::format("Inventory Path: {}", invpath).c_str());
+ log<level::DEBUG>(std::format("Inventory Path: {}", invpath).c_str());
if (nullptr != preslineptr)
{
@@ -249,7 +249,7 @@
buildDriverName(*i2cbus, *i2caddr);
log<level::DEBUG>(
- fmt::format("make PowerSupply bus: {} addr: {} presline: {}",
+ std::format("make PowerSupply bus: {} addr: {} presline: {}",
*i2cbus, *i2caddr, presline)
.c_str());
auto psu = std::make_unique<PowerSupply>(
@@ -270,7 +270,7 @@
if (psus.empty())
{
- log<level::INFO>(fmt::format("No power supplies to monitor").c_str());
+ log<level::INFO>(std::format("No power supplies to monitor").c_str());
}
else
{
@@ -394,7 +394,7 @@
if (itIntf != interfaces.cend())
{
log<level::INFO>(
- fmt::format("InterfacesAdded for: {}", IBMCFFPSInterface)
+ std::format("InterfacesAdded for: {}", IBMCFFPSInterface)
.c_str());
getPSUProperties(itIntf->second);
updateMissingPSUs();
@@ -461,7 +461,7 @@
}
}
log<level::INFO>(
- fmt::format(
+ std::format(
"powerStateChanged: power on: {}, power fault occurring: {}",
powerOn, powerFaultOccurring)
.c_str());
@@ -502,7 +502,7 @@
catch (const std::exception& e)
{
log<level::INFO>(
- fmt::format("Failed calling setPowerSupplyError due to error {}",
+ std::format("Failed calling setPowerSupplyError due to error {}",
e.what())
.c_str());
}
@@ -541,7 +541,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"Failed creating event log for fault {} due to error {}",
faultName, e.what())
.c_str());
@@ -629,8 +629,8 @@
// Add STATUS_WORD and STATUS_MFR last response, in padded
// hexadecimal format.
additionalData["STATUS_WORD"] =
- fmt::format("{:#04x}", psu->getStatusWord());
- additionalData["STATUS_MFR"] = fmt::format("{:#02x}",
+ std::format("{:#04x}", psu->getStatusWord());
+ additionalData["STATUS_MFR"] = std::format("{:#02x}",
psu->getMFRFault());
// If there are faults being reported, they possibly could be
// related to a bug in the firmware version running on the power
@@ -640,7 +640,7 @@
if (psu->hasCommFault())
{
additionalData["STATUS_CML"] =
- fmt::format("{:#02x}", psu->getStatusCML());
+ std::format("{:#02x}", psu->getStatusCML());
/* Attempts to communicate with the power supply have
* reached there limit. Create an error. */
additionalData["CALLOUT_DEVICE_PATH"] =
@@ -656,7 +656,7 @@
{
// Include STATUS_INPUT for input faults.
additionalData["STATUS_INPUT"] =
- fmt::format("{:#02x}", psu->getStatusInput());
+ std::format("{:#02x}", psu->getStatusInput());
/* The power supply location might be needed if the input
* fault is due to a problem with the power supply itself.
@@ -682,7 +682,7 @@
{
// Include STATUS_VOUT for Vout faults.
additionalData["STATUS_VOUT"] =
- fmt::format("{:#02x}", psu->getStatusVout());
+ std::format("{:#02x}", psu->getStatusVout());
additionalData["CALLOUT_INVENTORY_PATH"] =
psu->getInventoryPath();
@@ -697,7 +697,7 @@
{
// Include STATUS_IOUT for Iout faults.
additionalData["STATUS_IOUT"] =
- fmt::format("{:#02x}", psu->getStatusIout());
+ std::format("{:#02x}", psu->getStatusIout());
createError(
"xyz.openbmc_project.Power.PowerSupply.Error.IoutOCFault",
@@ -710,7 +710,7 @@
{
// Include STATUS_VOUT for Vout faults.
additionalData["STATUS_VOUT"] =
- fmt::format("{:#02x}", psu->getStatusVout());
+ std::format("{:#02x}", psu->getStatusVout());
additionalData["CALLOUT_INVENTORY_PATH"] =
psu->getInventoryPath();
@@ -728,9 +728,9 @@
{
// Include STATUS_TEMPERATURE and STATUS_FANS_1_2
additionalData["STATUS_TEMPERATURE"] =
- fmt::format("{:#02x}", psu->getStatusTemperature());
+ std::format("{:#02x}", psu->getStatusTemperature());
additionalData["STATUS_FANS_1_2"] =
- fmt::format("{:#02x}", psu->getStatusFans12());
+ std::format("{:#02x}", psu->getStatusFans12());
additionalData["CALLOUT_INVENTORY_PATH"] =
psu->getInventoryPath();
@@ -745,7 +745,7 @@
{
// Include STATUS_TEMPERATURE for temperature faults.
additionalData["STATUS_TEMPERATURE"] =
- fmt::format("{:#02x}", psu->getStatusTemperature());
+ std::format("{:#02x}", psu->getStatusTemperature());
additionalData["CALLOUT_INVENTORY_PATH"] =
psu->getInventoryPath();
@@ -842,7 +842,7 @@
additionalData.emplace("PGOOD_FAULT_COUNT",
std::to_string(pgoodFailedCount));
log<level::INFO>(
- fmt::format(
+ std::format(
"Brownout detected, not present count: {}, AC fault count {}, pgood fault count: {}",
notPresentCount, acFailedCount, pgoodFailedCount)
.c_str());
@@ -877,7 +877,7 @@
// condition by setting the PowerSystemInputs status
// property to Good.
log<level::INFO>(
- fmt::format(
+ std::format(
"Brownout cleared, not present count: {}, AC fault count {}, pgood fault count: {}",
notPresentCount, acFailedCount, pgoodFailedCount)
.c_str());
@@ -890,7 +890,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("Error trying to clear brownout, error: {}",
+ std::format("Error trying to clear brownout, error: {}",
e.what())
.c_str());
}
@@ -940,7 +940,7 @@
// Relying on property change or interface added to retry.
// Log an informational trace to the journal.
log<level::INFO>(
- fmt::format("D-Bus property {} access failure exception",
+ std::format("D-Bus property {} access failure exception",
psuInventoryPath)
.c_str());
}
@@ -1324,7 +1324,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(fmt::format("Failed to find device driver {}, error {}",
+ log<level::ERR>(std::format("Failed to find device driver {}, error {}",
symLinkPath, e.what())
.c_str());
}
diff --git a/phosphor-power-supply/util.cpp b/phosphor-power-supply/util.cpp
index 503e1c3..d1253da 100644
--- a/phosphor-power-supply/util.cpp
+++ b/phosphor-power-supply/util.cpp
@@ -62,7 +62,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("Failed to get_value of GPIO line: {}", e.what())
+ std::format("Failed to get_value of GPIO line: {}", e.what())
.c_str());
line.release();
throw;
diff --git a/phosphor-power-supply/util.hpp b/phosphor-power-supply/util.hpp
index 22e192e..293d44d 100644
--- a/phosphor-power-supply/util.hpp
+++ b/phosphor-power-supply/util.hpp
@@ -3,8 +3,6 @@
#include "utility.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
-#include <fmt/format.h>
-
#include <gpiod.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
@@ -12,6 +10,7 @@
#include <bitset>
#include <chrono>
+#include <format>
namespace phosphor::power::psu
{
@@ -43,7 +42,7 @@
bool present, const std::string& name) const override
{
using namespace phosphor::logging;
- log<level::INFO>(fmt::format("Updating inventory present property. "
+ log<level::INFO>(std::format("Updating inventory present property. "
"present:{} invpath:{} name:{}",
present, invpath, name)
.c_str());
@@ -81,7 +80,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"Error in inventory manager call to update inventory: {}",
e.what())
.c_str());
@@ -116,7 +115,7 @@
{
using namespace phosphor::logging;
log<level::ERR>(
- fmt::format("Error in inventory manager call to update "
+ std::format("Error in inventory manager call to update "
"availability interface: {}",
e.what())
.c_str());
@@ -188,7 +187,7 @@
catch (const sdbusplus::exception_t& e)
{
using namespace phosphor::logging;
- log<level::INFO>(fmt::format("Error trying to handle health rollup "
+ log<level::INFO>(std::format("Error trying to handle health rollup "
"associations for {}: {}",
invpath, e.what())
.c_str());
@@ -209,7 +208,7 @@
if (chassisPaths.empty())
{
- throw std::runtime_error(fmt::format(
+ throw std::runtime_error(std::format(
"No association to a chassis found for {}", invpath));
}
diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap
deleted file mode 100644
index 6847ae5..0000000
--- a/subprojects/fmt.wrap
+++ /dev/null
@@ -1,3 +0,0 @@
-[wrap-git]
-url = https://github.com/fmtlib/fmt
-revision = HEAD