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/json_config.hpp b/json_config.hpp
index b12cdb9..c3f041f 100644
--- a/json_config.hpp
+++ b/json_config.hpp
@@ -17,14 +17,13 @@
#include "sdbusplus.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdeventplus/source/signal.hpp>
#include <filesystem>
+#include <format>
#include <fstream>
namespace phosphor::fan
@@ -69,7 +68,7 @@
* @param[in] details - Additional details
*/
NoConfigFound(const std::string& appName, const std::string& fileName) :
- std::runtime_error(fmt::format("JSON configuration not found [Could "
+ std::runtime_error(std::format("JSON configuration not found [Could "
"not find fan {} conf file {}]",
appName, fileName)
.c_str())
@@ -271,7 +270,7 @@
if (!confFile.empty() && fs::exists(confFile))
{
log<level::INFO>(
- fmt::format("Loading configuration from {}", confFile.string())
+ std::format("Loading configuration from {}", confFile.string())
.c_str());
file.open(confFile);
try
@@ -282,12 +281,12 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"Failed to parse JSON config file: {}, error: {}",
confFile.string(), e.what())
.c_str());
throw std::runtime_error(
- fmt::format(
+ std::format(
"Failed to parse JSON config file: {}, error: {}",
confFile.string(), e.what())
.c_str());
@@ -295,11 +294,11 @@
}
else
{
- log<level::ERR>(fmt::format("Unable to open JSON config file: {}",
+ log<level::ERR>(std::format("Unable to open JSON config file: {}",
confFile.string())
.c_str());
throw std::runtime_error(
- fmt::format("Unable to open JSON config file: {}",
+ std::format("Unable to open JSON config file: {}",
confFile.string())
.c_str());
}