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/monitor/json_parser.cpp b/monitor/json_parser.cpp
index 4d06540..b5b7291 100644
--- a/monitor/json_parser.cpp
+++ b/monitor/json_parser.cpp
@@ -23,12 +23,11 @@
#include "tach_sensor.hpp"
#include "types.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
#include <map>
#include <memory>
#include <optional>
@@ -213,7 +212,7 @@
auto deviation = fan["deviation"].get<size_t>();
if (100 < deviation)
{
- auto msg = fmt::format(
+ auto msg = std::format(
"Invalid deviation of {} found, must be between 0 and 100",
deviation);
@@ -230,7 +229,7 @@
if (100 < upperDeviation)
{
auto msg =
- fmt::format("Invalid upper_deviation of {} found, must "
+ std::format("Invalid upper_deviation of {} found, must "
"be between 0 and 100",
upperDeviation);
@@ -409,7 +408,7 @@
}
else if (state != "runtime")
{
- auto msg = fmt::format("Invalid power off state entry {}", state);
+ auto msg = std::format("Invalid power off state entry {}", state);
log<level::ERR>(msg.c_str());
throw std::runtime_error(msg.c_str());
}
@@ -449,7 +448,7 @@
else
{
auto msg =
- fmt::format("Invalid power off cause {} in power off config JSON",
+ std::format("Invalid power off cause {} in power off config JSON",
powerOffCause);
log<level::ERR>(msg.c_str());
throw std::runtime_error(msg.c_str());
@@ -509,7 +508,7 @@
}
else
{
- auto msg = fmt::format("Invalid 'type' entry {} in power off config",
+ auto msg = std::format("Invalid 'type' entry {} in power off config",
type);
log<level::ERR>(msg.c_str());
throw std::runtime_error(msg.c_str());