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/sensor-monitor/threshold_alarm_logger.cpp b/sensor-monitor/threshold_alarm_logger.cpp
index 99ed0d6..13058e7 100644
--- a/sensor-monitor/threshold_alarm_logger.cpp
+++ b/sensor-monitor/threshold_alarm_logger.cpp
@@ -17,12 +17,13 @@
#include "sdbusplus.hpp"
-#include <fmt/format.h>
#include <unistd.h>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Logging/Entry/server.hpp>
+#include <format>
+
namespace sensor::monitor
{
@@ -284,7 +285,7 @@
if (properties == it->second.end())
{
log<level::INFO>(
- fmt::format("Could not find {} in threshold alarms map",
+ std::format("Could not find {} in threshold alarms map",
alarmProperty)
.c_str());
return;
@@ -301,7 +302,7 @@
ad.emplace("SENSOR_VALUE", std::to_string(sensorValue));
log<level::INFO>(
- fmt::format("Threshold Event {} {} = {} (sensor value {})",
+ std::format("Threshold Event {} {} = {} (sensor value {})",
sensorPath, alarmProperty, alarmValue, sensorValue)
.c_str());
}
@@ -311,7 +312,7 @@
// not be in the mapper yet. This could only happen if the sensor
// application was started up after this one and the value exceeded the
// threshold immediately.
- log<level::INFO>(fmt::format("Threshold Event {} {} = {}", sensorPath,
+ log<level::INFO>(std::format("Threshold Event {} {} = {}", sensorPath,
alarmProperty, alarmValue)
.c_str());
}
@@ -341,7 +342,7 @@
if ((sensorPath.back() == '/') || (pos == std::string::npos))
{
log<level::ERR>(
- fmt::format("Cannot get sensor type from sensor path {}",
+ std::format("Cannot get sensor type from sensor path {}",
sensorPath)
.c_str());
throw std::runtime_error("Invalid sensor path");