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/actions/action.hpp b/control/json/actions/action.hpp
index dcba6ea..0377a8a 100644
--- a/control/json/actions/action.hpp
+++ b/control/json/actions/action.hpp
@@ -20,12 +20,11 @@
#include "config_base.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
#include <functional>
#include <iterator>
#include <map>
@@ -67,7 +66,7 @@
*/
ActionParseError(const std::string& name, const std::string& details) :
std::runtime_error(
- fmt::format("Failed to parse action {} [{}]", name, details)
+ std::format("Failed to parse action {} [{}]", name, details)
.c_str())
{}
};
@@ -299,7 +298,7 @@
else
{
log<level::ERR>(
- fmt::format("Action '{}' is already registered", name).c_str());
+ std::format("Action '{}' is already registered", name).c_str());
throw std::runtime_error("Actions with the same name found");
}
@@ -338,7 +337,7 @@
return std::move(list) + ", " + act.first;
});
log<level::ERR>(
- fmt::format("Action '{}' is not registered", name).c_str(),
+ std::format("Action '{}' is not registered", name).c_str(),
entry("AVAILABLE_ACTIONS=%s", acts.c_str()));
throw std::runtime_error("Unsupported action name given");
}
diff --git a/control/json/actions/count_state_target.cpp b/control/json/actions/count_state_target.cpp
index dcbd70d..b2a900b 100644
--- a/control/json/actions/count_state_target.cpp
+++ b/control/json/actions/count_state_target.cpp
@@ -20,10 +20,10 @@
#include "action.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
+#include <format>
+
namespace phosphor::fan::control::json
{
diff --git a/control/json/actions/mapped_floor.cpp b/control/json/actions/mapped_floor.cpp
index c947098..97f659f 100644
--- a/control/json/actions/mapped_floor.cpp
+++ b/control/json/actions/mapped_floor.cpp
@@ -20,11 +20,10 @@
#include "group.hpp"
#include "sdeventplus.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <algorithm>
+#include <format>
namespace phosphor::fan::control::json
{
@@ -43,7 +42,7 @@
if (newFloor < 0)
{
log<level::ERR>(
- fmt::format("{}: Floor offset of {} resulted in negative floor",
+ std::format("{}: Floor offset of {} resulted in negative floor",
actionName, offset)
.c_str());
return floor;
@@ -72,7 +71,7 @@
{
throw ActionParseError{
ActionBase::getName(),
- fmt::format("Group name {} is not a valid group", name)};
+ std::format("Group name {} is not a valid group", name)};
}
return &(*groupIt);
@@ -195,7 +194,7 @@
{
throw ActionParseError{
ActionBase::getName(),
- fmt::format("condition_group {} must only have 1 member",
+ std::format("condition_group {} must only have 1 member",
_conditionGroup->getName())};
}
@@ -267,7 +266,7 @@
!std::is_same_v<int32_t, V> &&
!std::is_same_v<int64_t, V>)
{
- throw std::runtime_error{fmt::format(
+ throw std::runtime_error{std::format(
"{}: Group {} has more than one member but "
"isn't numeric",
ActionBase::getName(), group.getName())};
@@ -404,7 +403,7 @@
// If the parameter isn't there, then don't use
// this floor table
log<level::DEBUG>(
- fmt::format("{}: Parameter {} specified in the JSON "
+ std::format("{}: Parameter {} specified in the JSON "
"could not be found",
ActionBase::getName(),
std::get<std::string>(groupOrParameter))
diff --git a/control/json/actions/missing_owner_target.cpp b/control/json/actions/missing_owner_target.cpp
index 30f91b4..2138a06 100644
--- a/control/json/actions/missing_owner_target.cpp
+++ b/control/json/actions/missing_owner_target.cpp
@@ -19,12 +19,11 @@
#include "../zone.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
namespace phosphor::fan::control::json
{
diff --git a/control/json/actions/net_target_decrease.cpp b/control/json/actions/net_target_decrease.cpp
index 044622d..a9fe8d1 100644
--- a/control/json/actions/net_target_decrease.cpp
+++ b/control/json/actions/net_target_decrease.cpp
@@ -20,12 +20,11 @@
#include "action.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
#include <variant>
namespace phosphor::fan::control::json
@@ -124,7 +123,7 @@
{
// Unsupported group member type for this action
log<level::ERR>(
- fmt::format("Action {}: Unsupported group member type "
+ std::format("Action {}: Unsupported group member type "
"given. [object = {} : {} : {}]",
ActionBase::getName(), member,
group.getInterface(), group.getProperty())
diff --git a/control/json/actions/net_target_increase.cpp b/control/json/actions/net_target_increase.cpp
index 878dd3f..7341a35 100644
--- a/control/json/actions/net_target_increase.cpp
+++ b/control/json/actions/net_target_increase.cpp
@@ -20,12 +20,11 @@
#include "action.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
#include <variant>
namespace phosphor::fan::control::json
@@ -117,7 +116,7 @@
{
// Unsupported group member type for this action
log<level::ERR>(
- fmt::format("Action {}: Unsupported group member type "
+ std::format("Action {}: Unsupported group member type "
"given. [object = {} : {} : {}]",
ActionBase::getName(), member,
group.getInterface(), group.getProperty())
diff --git a/control/json/actions/pcie_card_floors.cpp b/control/json/actions/pcie_card_floors.cpp
index 3d242d3..106d42f 100644
--- a/control/json/actions/pcie_card_floors.cpp
+++ b/control/json/actions/pcie_card_floors.cpp
@@ -67,7 +67,7 @@
if (group.getInterface() != powerStateIface)
{
log<level::DEBUG>(
- fmt::format("Wrong interface {} in PCIe card floor group",
+ std::format("Wrong interface {} in PCIe card floor group",
group.getInterface())
.c_str());
continue;
@@ -85,7 +85,7 @@
catch (const std::out_of_range& oore)
{
log<level::ERR>(
- fmt::format("Could not get power state for {}", slotPath)
+ std::format("Could not get power state for {}", slotPath)
.c_str());
continue;
}
@@ -117,7 +117,7 @@
}
}
- auto status = fmt::format(
+ auto status = std::format(
"Found {} hot cards, {} with temp sensors, {} uninteresting", hotCards,
numTempSensorCards, uninterestingCards);
if (status != _lastStatus)
@@ -137,14 +137,14 @@
{
if (origIndex != floorIndex)
{
- record(fmt::format("Setting {} parameter to {}", floorIndexParam,
+ record(std::format("Setting {} parameter to {}", floorIndexParam,
floorIndex));
Manager::setParameter(floorIndexParam, floorIndex);
}
}
else if (origIndexVariant)
{
- record(fmt::format("Removing parameter {}", floorIndexParam));
+ record(std::format("Removing parameter {}", floorIndexParam));
Manager::setParameter(floorIndexParam, std::nullopt);
}
}
@@ -188,7 +188,7 @@
catch (const std::out_of_range& oore)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"{}: Could not get PCIeDevice property {} {} from cache ",
ActionBase::getName(), objectPath, propertyName)
.c_str());
@@ -203,7 +203,7 @@
catch (const std::invalid_argument& e)
{
log<level::INFO>(
- fmt::format("{}: {} has invalid PCIeDevice property {} value: {}",
+ std::format("{}: {} has invalid PCIeDevice property {} value: {}",
ActionBase::getName(), objectPath, propertyName,
std::get<std::string>(variantValue))
.c_str());
@@ -258,7 +258,7 @@
if (it == _pcieDevices.end())
{
- throw std::runtime_error(fmt::format(
+ throw std::runtime_error(std::format(
"Could not find PCIe card object path for slot {}", slotPath));
}
diff --git a/control/json/actions/request_target_base.cpp b/control/json/actions/request_target_base.cpp
index 4bcaabb..f52a19b 100644
--- a/control/json/actions/request_target_base.cpp
+++ b/control/json/actions/request_target_base.cpp
@@ -19,12 +19,11 @@
#include "../zone.hpp"
#include "group.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
+#include <format>
namespace phosphor::fan::control::json
{
@@ -75,7 +74,7 @@
{
// Unsupported group member type for this action
log<level::ERR>(
- fmt::format("Action {}: Unsupported group member type "
+ std::format("Action {}: Unsupported group member type "
"given. [object = {} : {} : {}]",
getName(), member, group.getInterface(),
group.getProperty())
diff --git a/control/json/actions/set_parameter_from_group_max.cpp b/control/json/actions/set_parameter_from_group_max.cpp
index b42f582..10c2b70 100644
--- a/control/json/actions/set_parameter_from_group_max.cpp
+++ b/control/json/actions/set_parameter_from_group_max.cpp
@@ -17,7 +17,7 @@
#include "../manager.hpp"
-#include <fmt/format.h>
+#include <format>
namespace phosphor::fan::control::json
{
@@ -69,7 +69,7 @@
!std::is_same_v<int32_t, V> &&
!std::is_same_v<int64_t, V>)
{
- log<level::ERR>(fmt::format("{}: Group {} has more "
+ log<level::ERR>(std::format("{}: Group {} has more "
"than one member but "
"isn't numeric",
ActionBase::getName(),
@@ -105,7 +105,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("{}: Could not perform modifier operation: {}",
+ std::format("{}: Could not perform modifier operation: {}",
ActionBase::getName(), e.what())
.c_str());
return;
diff --git a/control/json/actions/target_from_group_max.cpp b/control/json/actions/target_from_group_max.cpp
index 79cacf8..045b2d5 100644
--- a/control/json/actions/target_from_group_max.cpp
+++ b/control/json/actions/target_from_group_max.cpp
@@ -17,8 +17,7 @@
#include "../manager.hpp"
-#include <fmt/format.h>
-
+#include <format>
#include <iostream>
namespace phosphor::fan::control::json
@@ -191,7 +190,7 @@
!std::is_same_v<int32_t, V> &&
!std::is_same_v<int64_t, V>)
{
- log<level::ERR>(fmt::format("{}: Group {}'s member "
+ log<level::ERR>(std::format("{}: Group {}'s member "
"isn't numeric",
ActionBase::getName(),
group.getName())
diff --git a/control/json/actions/timer_based_actions.cpp b/control/json/actions/timer_based_actions.cpp
index e3f3fec..81d8fc1 100644
--- a/control/json/actions/timer_based_actions.cpp
+++ b/control/json/actions/timer_based_actions.cpp
@@ -23,12 +23,11 @@
#include "sdeventplus.hpp"
#include "zone.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <algorithm>
#include <chrono>
+#include <format>
namespace phosphor::fan::control::json
{
@@ -180,7 +179,7 @@
else
{
throw ActionParseError{
- getName(), fmt::format("Timer type '{}' is not supported", type)};
+ getName(), std::format("Timer type '{}' is not supported", type)};
}
}
diff --git a/control/json/dbus_zone.cpp b/control/json/dbus_zone.cpp
index 6397151..6e269c3 100644
--- a/control/json/dbus_zone.cpp
+++ b/control/json/dbus_zone.cpp
@@ -21,14 +21,13 @@
#include "sdbusplus.hpp"
#include "zone.hpp"
-#include <fmt/format.h>
-
#include <cereal/archives/json.hpp>
#include <cereal/cereal.hpp>
#include <phosphor-logging/log.hpp>
#include <algorithm>
#include <filesystem>
+#include <format>
#include <fstream>
namespace phosphor::fan::control::json
@@ -92,7 +91,7 @@
std::error_code ec;
fs::remove(path, ec);
log<level::ERR>(
- fmt::format("Unable to restore persisted `Current` thermal mode "
+ std::format("Unable to restore persisted `Current` thermal mode "
"property ({}, ec: {})",
e.what(), ec.value())
.c_str());
diff --git a/control/json/event.cpp b/control/json/event.cpp
index 74f2ddf..3a74f30 100644
--- a/control/json/event.cpp
+++ b/control/json/event.cpp
@@ -22,13 +22,12 @@
#include "sdbusplus.hpp"
#include "trigger.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <algorithm>
+#include <format>
#include <optional>
namespace phosphor::fan::control::json
@@ -148,7 +147,7 @@
{
if (!jsonGrp.contains("name"))
{
- auto msg = fmt::format("Missing required group name attribute");
+ auto msg = std::format("Missing required group name attribute");
log<level::ERR>(msg.c_str(),
entry("JSON=%s", jsonGrp.dump().c_str()));
throw std::runtime_error(msg.c_str());
@@ -222,7 +221,7 @@
if (actionZones.empty())
{
log<level::DEBUG>(
- fmt::format("No zones configured for event {}'s action {} "
+ std::format("No zones configured for event {}'s action {} "
"based on the active profile(s)",
getName(), jsonAct["name"].get<std::string>())
.c_str());
@@ -260,7 +259,7 @@
if (actionGroups.empty() && _groups.empty())
{
log<level::DEBUG>(
- fmt::format("No groups configured for event {}'s action {} "
+ std::format("No groups configured for event {}'s action {} "
"based on the active profile(s)",
getName(), jsonAct["name"].get<std::string>())
.c_str());
@@ -303,7 +302,7 @@
return std::move(list) + ", " + trig.first;
});
log<level::ERR>(
- fmt::format("Trigger '{}' is not recognized", tClass).c_str(),
+ std::format("Trigger '{}' is not recognized", tClass).c_str(),
entry("AVAILABLE_TRIGGERS=%s", availTrigs.c_str()));
throw std::runtime_error("Unsupported trigger class name given");
}
diff --git a/control/json/fan.cpp b/control/json/fan.cpp
index 26b2174..0010d2b 100644
--- a/control/json/fan.cpp
+++ b/control/json/fan.cpp
@@ -17,12 +17,12 @@
#include "sdbusplus.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <format>
+
namespace phosphor::fan::control::json
{
@@ -117,7 +117,7 @@
catch (const sdbusplus::exception_t&)
{
throw util::DBusPropertyError{
- fmt::format("Failed to set target for fan {}", _name).c_str(),
+ std::format("Failed to set target for fan {}", _name).c_str(),
sensor.second, sensor.first, _interface, FAN_TARGET_PROPERTY};
}
}
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index fe5fc0d..5121e97 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -97,7 +97,7 @@
log<level::ERR>("Error reloading configs, no changes made",
entry("LOAD_ERROR=%s", re.what()));
FlightRecorder::instance().log(
- "main", fmt::format("Error reloading configs, no changes made: {}",
+ "main", std::format("Error reloading configs, no changes made: {}",
re.what()));
}
}
@@ -539,7 +539,7 @@
{
// Log service not found for object
log<level::DEBUG>(
- fmt::format(
+ std::format(
"Unable to get service name for path {}, interface {}",
path, intf)
.c_str());
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index ad92720..369b6bf 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -25,8 +25,6 @@
#include "utils/flight_recorder.hpp"
#include "zone.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
@@ -36,6 +34,7 @@
#include <sdeventplus/utility/timer.hpp>
#include <chrono>
+#include <format>
#include <map>
#include <memory>
#include <optional>
@@ -210,7 +209,7 @@
if (!confFile.empty())
{
FlightRecorder::instance().log(
- "main", fmt::format("Loading configuration from {}",
+ "main", std::format("Loading configuration from {}",
confFile.string()));
for (const auto& entry : fan::JsonConfig::load(confFile))
{
@@ -242,11 +241,11 @@
std::move(obj));
}
log<level::INFO>(
- fmt::format("Configuration({}) loaded successfully",
+ std::format("Configuration({}) loaded successfully",
T::confFileName)
.c_str());
FlightRecorder::instance().log(
- "main", fmt::format("Configuration({}) loaded successfully",
+ "main", std::format("Configuration({}) loaded successfully",
T::confFileName));
}
return config;
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");
diff --git a/control/json/utils/flight_recorder.cpp b/control/json/utils/flight_recorder.cpp
index 8c8ce06..00325f5 100644
--- a/control/json/utils/flight_recorder.cpp
+++ b/control/json/utils/flight_recorder.cpp
@@ -15,12 +15,11 @@
*/
#include "flight_recorder.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/log.hpp>
#include <algorithm>
#include <ctime>
+#include <format>
#include <iomanip>
#include <sstream>
#include <vector>
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");
diff --git a/control/json/utils/pcie_card_metadata.cpp b/control/json/utils/pcie_card_metadata.cpp
index 6fd8fd1..8032081 100644
--- a/control/json/utils/pcie_card_metadata.cpp
+++ b/control/json/utils/pcie_card_metadata.cpp
@@ -19,8 +19,7 @@
#include "json_config.hpp"
#include "utils/flight_recorder.hpp"
-#include <fmt/format.h>
-
+#include <format>
#include <iostream>
static constexpr auto cardFileName = "pcie_cards.json";
@@ -52,12 +51,12 @@
{
FlightRecorder::instance().log(
"main",
- fmt::format("Loading configuration from {}", confFile.string()));
+ std::format("Loading configuration from {}", confFile.string()));
load(JsonConfig::load(confFile));
FlightRecorder::instance().log(
- "main", fmt::format("Configuration({}) loaded successfully",
+ "main", std::format("Configuration({}) loaded successfully",
confFile.string()));
- log<level::INFO>(fmt::format("Configuration({}) loaded successfully",
+ log<level::INFO>(std::format("Configuration({}) loaded successfully",
confFile.string())
.c_str());
}
@@ -80,14 +79,14 @@
if (fs::exists(confFile))
{
FlightRecorder::instance().log(
- "main", fmt::format("Loading configuration from {}",
+ "main", std::format("Loading configuration from {}",
confFile.string()));
load(JsonConfig::load(confFile));
FlightRecorder::instance().log(
- "main", fmt::format("Configuration({}) loaded successfully",
+ "main", std::format("Configuration({}) loaded successfully",
confFile.string()));
log<level::INFO>(
- fmt::format("Configuration({}) loaded successfully",
+ std::format("Configuration({}) loaded successfully",
confFile.string())
.c_str());
}
@@ -105,7 +104,7 @@
if (!json.contains("cards") || !json.at("cards").is_array())
{
throw std::runtime_error{
- fmt::format("Missing 'cards' array in PCIe card JSON")};
+ std::format("Missing 'cards' array in PCIe card JSON")};
}
for (const auto& card : json.at("cards"))
@@ -169,7 +168,7 @@
uint16_t subsystemID,
uint16_t subsystemVendorID) const
{
- log<level::DEBUG>(fmt::format("Lookup {:#x} ${:#x} {:#x} {:#x}", deviceID,
+ log<level::DEBUG>(std::format("Lookup {:#x} ${:#x} {:#x} {:#x}", deviceID,
vendorID, subsystemID, subsystemVendorID)
.c_str());
auto card = std::find_if(_cards.begin(), _cards.end(),
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index 2e31465..487a7d4 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -81,7 +81,7 @@
if (_defaultFloor > _ceiling)
{
log<level::ERR>(
- fmt::format("Configured default_floor({}) above ceiling({}), "
+ std::format("Configured default_floor({}) above ceiling({}), "
"setting default floor to ceiling",
_defaultFloor, _ceiling)
.c_str());
@@ -149,7 +149,7 @@
{
FlightRecorder::instance().log(
"zone-set-target" + getName(),
- fmt::format("Set target {} (from {})", target, _target));
+ std::format("Set target {} (from {})", target, _target));
}
_target = target;
for (auto& fan : _fans)
@@ -173,7 +173,7 @@
else
{
log<level::DEBUG>(
- fmt::format("Configured fan {} not found in zone {} to lock target",
+ std::format("Configured fan {} not found in zone {} to lock target",
fname, getName())
.c_str());
}
@@ -196,7 +196,7 @@
else
{
log<level::DEBUG>(
- fmt::format(
+ std::format(
"Configured fan {} not found in zone {} to unlock target",
fname, getName())
.c_str());
@@ -214,7 +214,7 @@
{
FlightRecorder::instance().log(
"zone-target"s + getName(),
- fmt::format("{} is removing target hold", ident));
+ std::format("{} is removing target hold", ident));
}
}
else
@@ -224,7 +224,7 @@
{
FlightRecorder::instance().log(
"zone-target"s + getName(),
- fmt::format("{} is setting target hold to {}", ident, target));
+ std::format("{} is setting target hold to {}", ident, target));
}
_targetHolds[ident] = target;
_isActive = false;
@@ -244,7 +244,7 @@
{
FlightRecorder::instance().log(
"zone-target"s + getName(),
- fmt::format("Settings fans to target hold of {}",
+ std::format("Settings fans to target hold of {}",
itHoldMax->second));
}
@@ -272,7 +272,7 @@
{
FlightRecorder::instance().log(
"zone-floor"s + getName(),
- fmt::format("{} is removing floor hold", ident));
+ std::format("{} is removing floor hold", ident));
}
}
else
@@ -282,7 +282,7 @@
{
FlightRecorder::instance().log(
"zone-floor"s + getName(),
- fmt::format("{} is setting floor hold to {}", ident, target));
+ std::format("{} is setting floor hold to {}", ident, target));
}
_floorHolds[ident] = target;
}
@@ -303,7 +303,7 @@
{
FlightRecorder::instance().log(
"zone-floor"s + getName(),
- fmt::format("No set floor exists, using default floor",
+ std::format("No set floor exists, using default floor",
_defaultFloor));
}
_floor = _defaultFloor;
@@ -314,7 +314,7 @@
{
FlightRecorder::instance().log(
"zone-floor"s + getName(),
- fmt::format("Setting new floor to {}", itHoldMax->second));
+ std::format("Setting new floor to {}", itHoldMax->second));
}
_floor = itHoldMax->second;
}