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