use std::format instead of fmt::format
The std::format is sufficient for the uses in this repository except
for in one file (override_fan_target.cpp, since P2286 isn't supported
by GCC yet). Switch to std::format whenever possible.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib2576fb530a4d7ce238e1b0bd95b40b476ec2107
diff --git a/control/json/triggers/init.cpp b/control/json/triggers/init.cpp
index f51a09e..32277d7 100644
--- a/control/json/triggers/init.cpp
+++ b/control/json/triggers/init.cpp
@@ -21,12 +21,11 @@
#include "sdbusplus.hpp"
#include "trigger_aliases.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
#include <iterator>
#include <memory>
#include <numeric>
@@ -109,7 +108,7 @@
// TODO How to handle this? Create timer to keep checking for
// object/service to appear? When to stop checking?
log<level::ERR>(
- fmt::format(
+ std::format(
"Unable to get service name for path {}, interface {}",
member, intf)
.c_str());
@@ -128,7 +127,7 @@
// Path and/or interface configured does not exist on dbus?
// TODO How to handle this? Create timer to keep checking for
// object/service to appear? When to stop checking?
- log<level::ERR>(fmt::format("Unable to get service({}) owner "
+ log<level::ERR>(std::format("Unable to get service({}) owner "
"state for path {}, interface {}",
servName, member, intf)
.c_str());
@@ -167,7 +166,7 @@
return std::move(list) + ", " + method.first;
});
auto msg =
- fmt::format("Event '{}' requires a supported method given to "
+ std::format("Event '{}' requires a supported method given to "
"be init driven, available methods: {}",
eventName, availMethods);
log<level::ERR>(msg.c_str());
diff --git a/control/json/triggers/parameter.cpp b/control/json/triggers/parameter.cpp
index 6f4eac3..6986608 100644
--- a/control/json/triggers/parameter.cpp
+++ b/control/json/triggers/parameter.cpp
@@ -17,7 +17,7 @@
#include "../manager.hpp"
-#include <fmt/format.h>
+#include <format>
namespace phosphor::fan::control::json::trigger::parameter
{
@@ -30,7 +30,7 @@
{
if (!jsonObj.contains("parameter"))
{
- auto msg = fmt::format(
+ auto msg = std::format(
"Event '{}' parameter trigger is missing 'parameter'", eventName);
log<level::ERR>(msg.c_str());
throw std::runtime_error(msg);
diff --git a/control/json/triggers/signal.cpp b/control/json/triggers/signal.cpp
index 7169d69..5e78d6e 100644
--- a/control/json/triggers/signal.cpp
+++ b/control/json/triggers/signal.cpp
@@ -21,13 +21,12 @@
#include "handlers.hpp"
#include "trigger_aliases.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus/match.hpp>
#include <algorithm>
+#include <format>
#include <functional>
#include <iterator>
#include <memory>
@@ -206,7 +205,7 @@
// TODO How to handle this? Create timer to keep checking for
// service to appear? When to stop checking?
log<level::ERR>(
- fmt::format("Events will not be triggered by name owner changed"
+ std::format("Events will not be triggered by name owner changed"
"signals from service of path {}, interface {}",
member, group.getInterface())
.c_str());
@@ -256,7 +255,7 @@
return std::move(list) + ", " + signal.first;
});
auto msg =
- fmt::format("Event '{}' requires a supported signal given to be "
+ std::format("Event '{}' requires a supported signal given to be "
"triggered by signal, available signals: {}",
eventName, availSignals);
log<level::ERR>(msg.c_str());
diff --git a/control/json/triggers/timer.cpp b/control/json/triggers/timer.cpp
index ce8bba7..2036042 100644
--- a/control/json/triggers/timer.cpp
+++ b/control/json/triggers/timer.cpp
@@ -19,12 +19,11 @@
#include "group.hpp"
#include "trigger_aliases.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <chrono>
+#include <format>
namespace phosphor::fan::control::json::trigger::timer
{
@@ -52,7 +51,7 @@
else
{
log<level::ERR>(
- fmt::format("Timer trigger type '{}' is not supported", type)
+ std::format("Timer trigger type '{}' is not supported", type)
.c_str(),
entry("AVAILABLE_TYPES={oneshot, repeating}"));
throw std::runtime_error("Unsupported timer trigger type given");