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/utils/modifier.cpp b/control/json/utils/modifier.cpp
index 91978e7..c8fb536 100644
--- a/control/json/utils/modifier.cpp
+++ b/control/json/utils/modifier.cpp
@@ -19,10 +19,10 @@
#include "json/config_base.hpp"
#include "json/manager.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/log.hpp>
+#include <format>
+
using namespace phosphor::logging;
namespace phosphor::fan::control::json
@@ -168,7 +168,7 @@
if (!valueArray.is_array())
{
log<level::ERR>(
- fmt::format("Invalid JSON data for less_than config: {}",
+ std::format("Invalid JSON data for less_than config: {}",
valueArray.dump())
.c_str());
throw std::invalid_argument("Invalid modifier JSON");
@@ -180,7 +180,7 @@
!valueEntry.contains("parameter_value"))
{
log<level::ERR>(
- fmt::format("Missing arg_value or parameter_value keys "
+ std::format("Missing arg_value or parameter_value keys "
"in less_than config: {}",
valueArray.dump())
.c_str());
@@ -192,7 +192,7 @@
if (std::holds_alternative<bool>(argVal))
{
log<level::ERR>(
- fmt::format(
+ std::format(
"Invalid data type in arg_value key in modifier JSON "
"config: {}",
valueArray.dump())
@@ -208,7 +208,7 @@
if (rangeValues.empty())
{
- log<level::ERR>(fmt::format("No valid range values found in "
+ log<level::ERR>(std::format("No valid range values found in "
"modifier json: {}",
valueArray.dump())
.c_str());
@@ -292,7 +292,7 @@
if (!jsonObj.contains("operator") || !jsonObj.contains("value"))
{
log<level::ERR>(
- fmt::format(
+ std::format(
"Modifier entry in JSON missing 'operator' or 'value': {}",
jsonObj.dump())
.c_str());
@@ -311,7 +311,7 @@
}
else
{
- log<level::ERR>(fmt::format("Invalid operator in the modifier JSON: {}",
+ log<level::ERR>(std::format("Invalid operator in the modifier JSON: {}",
jsonObj.dump())
.c_str());
throw std::invalid_argument("Invalid operator in the modifier JSON");