switch fmt::format to use std::format
fmt::format is supported in the c++ std. This will
help to remove fmt package dependency.
Change-Id: Ia3f5c607a348f062a0f112d5eae8b51ecc23fd37
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/extensions/phal/clock_logger.hpp b/extensions/phal/clock_logger.hpp
index d52293a..1c344b8 100644
--- a/extensions/phal/clock_logger.hpp
+++ b/extensions/phal/clock_logger.hpp
@@ -17,8 +17,6 @@
#include "extensions/phal/create_pel.hpp"
-#include <fmt/format.h>
-
#include <sdeventplus/utility/timer.hpp>
#include <chrono>
diff --git a/extensions/phal/clock_logger_main.cpp b/extensions/phal/clock_logger_main.cpp
index 7d85764..6d3aed0 100644
--- a/extensions/phal/clock_logger_main.cpp
+++ b/extensions/phal/clock_logger_main.cpp
@@ -16,8 +16,6 @@
#include "extensions/phal/clock_logger.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <sdeventplus/source/event.hpp>
diff --git a/extensions/phal/common_utils.cpp b/extensions/phal/common_utils.cpp
index fb90e88..47717b9 100644
--- a/extensions/phal/common_utils.cpp
+++ b/extensions/phal/common_utils.cpp
@@ -5,7 +5,6 @@
#include "extensions/phal/pdbg_utils.hpp"
#include "extensions/phal/phal_error.hpp"
-#include <fmt/format.h>
#include <libekb.H>
#include <phosphor-logging/log.hpp>
diff --git a/extensions/phal/create_pel.cpp b/extensions/phal/create_pel.cpp
index 95ee7ae..d3810ef 100644
--- a/extensions/phal/create_pel.cpp
+++ b/extensions/phal/create_pel.cpp
@@ -5,7 +5,6 @@
#include "util.hpp"
#include <fcntl.h>
-#include <fmt/format.h>
#include <libekb.H>
#include <libphal.H>
#include <unistd.h>
@@ -18,6 +17,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <format>
#include <map>
#include <stdexcept>
#include <string>
@@ -72,7 +72,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(fmt::format("getLocationCode({}): Exception({})",
+ log<level::ERR>(std::format("getLocationCode({}): Exception({})",
pdbg_target_path(procTarget), e.what())
.c_str());
}
@@ -118,7 +118,7 @@
catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
- fmt::format("D-Bus call exception",
+ std::format("D-Bus call exception",
"OBJPATH={}, INTERFACE={}, event={}, EXCEPTION={}",
loggingObjectPath, loggingInterface, event, e.what())
.c_str());
@@ -197,7 +197,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("Skipping SBE special callout due to Exception({})",
+ std::format("Skipping SBE special callout due to Exception({})",
e.what())
.c_str());
}
@@ -224,7 +224,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(fmt::format("D-Bus call exception",
+ log<level::ERR>(std::format("D-Bus call exception",
"OBJPATH={}, INTERFACE={}, EXCEPTION={}",
loggingObjectPath, loggingInterface,
e.what())
@@ -265,7 +265,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(fmt::format("sdbusplus D-Bus call exception",
+ log<level::ERR>(std::format("sdbusplus D-Bus call exception",
"OBJPATH={}, INTERFACE={}, EXCEPTION={}",
loggingObjectPath, loggingInterface,
e.what())
@@ -278,7 +278,7 @@
catch (const std::exception& e)
{
log<level::ERR>(
- fmt::format("D-bus call exception", "EXCEPTION={}", e.what())
+ std::format("D-bus call exception", "EXCEPTION={}", e.what())
.c_str());
throw e;
}
@@ -314,7 +314,7 @@
if (fileFD == -1)
{
- log<level::ERR>(fmt::format("Failed to create phalPELCallouts "
+ log<level::ERR>(std::format("Failed to create phalPELCallouts "
"file({}), errorno({}) and errormsg({})",
calloutFile, errno, strerror(errno))
.c_str());
@@ -328,7 +328,7 @@
if (rc == -1)
{
- log<level::ERR>(fmt::format("Failed to write phaPELCallout info "
+ log<level::ERR>(std::format("Failed to write phaPELCallout info "
"in file({}), errorno({}), errormsg({})",
calloutFile, errno, strerror(errno))
.c_str());
@@ -336,7 +336,7 @@
}
else if (rc != static_cast<ssize_t>(calloutData.size()))
{
- log<level::WARNING>(fmt::format("Could not write all phal callout "
+ log<level::WARNING>(std::format("Could not write all phal callout "
"info in file({}), written byte({}) "
"and total byte({})",
calloutFile, rc, calloutData.size())
@@ -350,7 +350,7 @@
if (rc == -1)
{
- log<level::ERR>(fmt::format("Failed to set SEEK_SET for "
+ log<level::ERR>(std::format("Failed to set SEEK_SET for "
"phalPELCallouts in file({}), errorno({}) "
"and errormsg({})",
calloutFile, errno, strerror(errno))
diff --git a/extensions/phal/devtree_export.cpp b/extensions/phal/devtree_export.cpp
index ad21332..afa6e6a 100644
--- a/extensions/phal/devtree_export.cpp
+++ b/extensions/phal/devtree_export.cpp
@@ -1,10 +1,10 @@
#include "fw_update_watch.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/elog-errors.hpp>
#include <sdeventplus/event.hpp>
+#include <format>
+
int main()
{
auto eventRet = 0;
@@ -27,7 +27,7 @@
{
using namespace phosphor::logging;
log<level::ERR>(
- fmt::format("Exception reported: [{}]", e.what()).c_str());
+ std::format("Exception reported: [{}]", e.what()).c_str());
}
return eventRet;
diff --git a/extensions/phal/dump_utils.cpp b/extensions/phal/dump_utils.cpp
index 61bdd92..59f7f67 100644
--- a/extensions/phal/dump_utils.cpp
+++ b/extensions/phal/dump_utils.cpp
@@ -2,13 +2,13 @@
#include "util.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/server.hpp>
+#include <format>
+
namespace openpower::phal::dump
{
@@ -43,7 +43,7 @@
"OperationStatus.InProgress" != *status))
{
// dump is done, trace some info and change in progress flag
- log<level::INFO>(fmt::format("Dump status({}) : path={}",
+ log<level::INFO>(std::format("Dump status({}) : path={}",
status->c_str(), path.c_str())
.c_str());
inProgress = false;
@@ -100,7 +100,7 @@
void requestDump(const DumpParameters& dumpParameters)
{
- log<level::INFO>(fmt::format("Requesting Dump PEL({}) Index({})",
+ log<level::INFO>(std::format("Requesting Dump PEL({}) Index({})",
dumpParameters.logId, dumpParameters.unitId)
.c_str());
@@ -142,7 +142,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(fmt::format("D-Bus call createDump exception",
+ log<level::ERR>(std::format("D-Bus call createDump exception",
"OBJPATH={}, INTERFACE={}, EXCEPTION={}",
path, interface, e.what())
.c_str());
@@ -152,7 +152,7 @@
{
// Dump is disabled, Skip the dump collection.
log<level::INFO>(
- fmt::format("Dump is disabled on({}), skipping dump collection",
+ std::format("Dump is disabled on({}), skipping dump collection",
dumpParameters.unitId)
.c_str());
}
diff --git a/extensions/phal/fw_update_watch.cpp b/extensions/phal/fw_update_watch.cpp
index b85c2f0..200d908 100644
--- a/extensions/phal/fw_update_watch.cpp
+++ b/extensions/phal/fw_update_watch.cpp
@@ -6,7 +6,6 @@
#include "create_pel.hpp"
#include "pdbg_utils.hpp"
-#include <fmt/format.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -16,6 +15,7 @@
#include <sdbusplus/exception.hpp>
#include <filesystem>
+#include <format>
namespace openpower
{
@@ -45,7 +45,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(fmt::format("Failed to parse software add signal"
+ log<level::ERR>(std::format("Failed to parse software add signal"
"Exception [{}] REPLY_SIG [{}]",
e.what(), msg.get_signature())
.c_str());
@@ -94,7 +94,7 @@
catch (const fs::filesystem_error& e)
{
log<level::ERR>(
- fmt::format("Filesystem error reported Error:({})", e.what())
+ std::format("Filesystem error reported Error:({})", e.what())
.c_str());
throw std::runtime_error(e.what());
}
@@ -115,7 +115,7 @@
if (!fs::exists(path))
{
log<level::ERR>(
- fmt::format("devtree export filter file is not available: ({})",
+ std::format("devtree export filter file is not available: ({})",
DEVTREE_EXPORT_FILTER_FILE)
.c_str());
openpower::pel::createPEL(ERROR_DEVTREE_BACKUP);
@@ -152,7 +152,7 @@
execl("/bin/sh", "sh", "-c", cmd.c_str(), 0);
auto error = errno;
- log<level::ERR>(fmt::format("Error occurred during attributes function "
+ log<level::ERR>(std::format("Error occurred during attributes function "
"execution, errno({})",
error)
.c_str());
diff --git a/extensions/phal/pdbg_utils.cpp b/extensions/phal/pdbg_utils.cpp
index db62522..a6a334f 100644
--- a/extensions/phal/pdbg_utils.cpp
+++ b/extensions/phal/pdbg_utils.cpp
@@ -8,10 +8,10 @@
#include "extensions/phal/pdbg_utils.hpp"
#include "extensions/phal/phal_error.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/log.hpp>
+#include <format>
+
namespace openpower
{
namespace phal
@@ -128,7 +128,7 @@
if (setenv("PDBG_DTB", CEC_DEVTREE_RW_PATH, 1))
{
log<level::ERR>(
- fmt::format("Failed to set PDBG_DTB: ({})", strerror(errno))
+ std::format("Failed to set PDBG_DTB: ({})", strerror(errno))
.c_str());
throw std::runtime_error("Failed to set PDBG_DTB");
}
@@ -143,7 +143,7 @@
if (setenv("PDATA_INFODB", PDATA_INFODB_PATH, 1))
{
log<level::ERR>(
- fmt::format("Failed to set PDATA_INFODB: ({})", strerror(errno))
+ std::format("Failed to set PDATA_INFODB: ({})", strerror(errno))
.c_str());
throw std::runtime_error("Failed to set PDATA_INFODB");
}
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index 4cbf5af..96ba115 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -10,7 +10,6 @@
#include "util.hpp"
#include <attributes_info.H>
-#include <fmt/format.h>
#include <libekb.H>
#include <libphal.H>
@@ -20,6 +19,7 @@
#include <algorithm>
#include <cstdlib>
#include <cstring>
+#include <format>
#include <iomanip>
#include <list>
#include <map>
@@ -121,7 +121,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(fmt::format("getLocationCode({}): Exception({})",
+ log<level::ERR>(std::format("getLocationCode({}): Exception({})",
pdbg_target_path(target), e.what())
.c_str());
}
@@ -129,14 +129,14 @@
if (DT_GET_PROP(ATTR_PHYS_DEV_PATH, target, targetInfo->physDevPath))
{
log<level::ERR>(
- fmt::format("Could not read({}) PHYS_DEV_PATH attribute",
+ std::format("Could not read({}) PHYS_DEV_PATH attribute",
pdbg_target_path(target))
.c_str());
}
if (DT_GET_PROP(ATTR_MRU_ID, target, targetInfo->mruId))
{
- log<level::ERR>(fmt::format("Could not read({}) ATTR_MRU_ID attribute",
+ log<level::ERR>(std::format("Could not read({}) ATTR_MRU_ID attribute",
pdbg_target_path(target))
.c_str());
}
@@ -168,9 +168,15 @@
&targetInfo);
if (ret == 0)
{
- log<level::ERR>(fmt::format("Given ATTR_PHYS_BIN_PATH value({:02x}) "
+ std::string fmt;
+ for (auto value : targetInfo.physBinPath)
+ {
+ fmt += std::format("{:02X} ", value);
+ }
+
+ log<level::ERR>(std::format("Given ATTR_PHYS_BIN_PATH value {} "
"not found in phal device tree",
- fmt::join(targetInfo.physBinPath, ""))
+ fmt)
.c_str());
return false;
}
@@ -253,7 +259,7 @@
auto it = priorityMap.find(phalPriority);
if (it == priorityMap.end())
{
- log<level::ERR>(fmt::format("Unsupported phal priority({}) is given "
+ log<level::ERR>(std::format("Unsupported phal priority({}) is given "
"to get pel priority format",
phalPriority)
.c_str());
@@ -309,7 +315,7 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(fmt::format("getLocationCode({}): Exception({})",
+ log<level::ERR>(std::format("getLocationCode({}): Exception({})",
pdbg_target_path(procTarget), e.what())
.c_str());
}
@@ -341,7 +347,7 @@
try
{
log<level::INFO>(
- fmt::format("processClockInfoErrorHelper: FFDC Message[{}]",
+ std::format("processClockInfoErrorHelper: FFDC Message[{}]",
ffdc->message)
.c_str());
@@ -418,7 +424,7 @@
void processIplErrorCallback(const ipl_error_info& errInfo)
{
log<level::INFO>(
- fmt::format("processIplErrorCallback: Error type({})",
+ std::format("processIplErrorCallback: Error type({})",
static_cast<std::underlying_type<ipl_error_type>::type>(
errInfo.type))
.c_str());
@@ -499,7 +505,7 @@
try
{
log<level::INFO>(
- fmt::format("processPoweroffError: Message[{}]", ffdc->message)
+ std::format("processPoweroffError: Message[{}]", ffdc->message)
.c_str());
// To store phal trace and other additional data about ffdc.
@@ -519,7 +525,7 @@
(ffdc->ffdc_type != FFDC_TYPE_UNSUPPORTED))
{
log<level::ERR>(
- fmt::format("Unsupported phal FFDC type to create PEL. "
+ std::format("Unsupported phal FFDC type to create PEL. "
"MSG: {}",
ffdc->message)
.c_str());
@@ -550,7 +556,7 @@
try
{
log<level::INFO>(
- fmt::format("PHAL FFDC: Return Message[{}]", ffdc->message)
+ std::format("PHAL FFDC: Return Message[{}]", ffdc->message)
.c_str());
// Special handling for spare clock related errors.
@@ -747,7 +753,7 @@
(ffdc->ffdc_type != FFDC_TYPE_UNSUPPORTED))
{
log<level::ERR>(
- fmt::format("Unsupported phal FFDC type to create PEL. "
+ std::format("Unsupported phal FFDC type to create PEL. "
"MSG: {}",
ffdc->message)
.c_str());
@@ -816,7 +822,7 @@
catch (const std::exception& ex)
{
log<level::ERR>(
- fmt::format("processPlatBootError: exception({})", ex.what())
+ std::format("processPlatBootError: exception({})", ex.what())
.c_str());
throw ex;
}
@@ -825,7 +831,7 @@
void processBootError(bool status)
{
log<level::INFO>(
- fmt::format("processBootError: status({})", status).c_str());
+ std::format("processBootError: status({})", status).c_str());
try
{
@@ -848,7 +854,7 @@
catch (const std::exception& ex)
{
log<level::ERR>(
- fmt::format("processBootError: exception({})", ex.what()).c_str());
+ std::format("processBootError: exception({})", ex.what()).c_str());
throw ex;
}
}
@@ -909,7 +915,7 @@
{
// Fail to collect FFDC information , trigger Dump
log<level::ERR>(
- fmt::format("captureFFDC: Exception({})", phalError.what())
+ std::format("captureFFDC: Exception({})", phalError.what())
.c_str());
dumpIsRequired = true;
}
diff --git a/procedures/p9/enter_mpreboot.cpp b/procedures/p9/enter_mpreboot.cpp
index 301bf7d..048f101 100644
--- a/procedures/p9/enter_mpreboot.cpp
+++ b/procedures/p9/enter_mpreboot.cpp
@@ -22,12 +22,12 @@
#include <libpdbg_sbe.h>
}
-#include <fmt/format.h>
#include <sys/wait.h>
#include <unistd.h>
#include <phosphor-logging/log.hpp>
+#include <format>
#include <system_error>
#include <vector>
@@ -53,7 +53,7 @@
}
log<level::INFO>(
- fmt::format("Enter MPIPL completed on proc({})", pdbg_target_index(tgt))
+ std::format("Enter MPIPL completed on proc({})", pdbg_target_index(tgt))
.c_str());
}
diff --git a/procedures/p9/thread_stopall.cpp b/procedures/p9/thread_stopall.cpp
index 8d5f755..6503fa4 100644
--- a/procedures/p9/thread_stopall.cpp
+++ b/procedures/p9/thread_stopall.cpp
@@ -1,6 +1,5 @@
#include "registration.hpp"
-#include <fmt/format.h>
extern "C"
{
#include <libpdbg.h>
diff --git a/procedures/phal/enter_mpreboot.cpp b/procedures/phal/enter_mpreboot.cpp
index 0db9889..1200399 100644
--- a/procedures/phal/enter_mpreboot.cpp
+++ b/procedures/phal/enter_mpreboot.cpp
@@ -26,7 +26,6 @@
#include "extensions/phal/dump_utils.hpp"
#include <attributes_info.H>
-#include <fmt/format.h>
#include <libphal.H>
#include <phal_exception.H>
#include <sys/wait.h>
@@ -34,6 +33,7 @@
#include <phosphor-logging/log.hpp>
+#include <format>
#include <system_error>
#include <vector>
@@ -65,13 +65,13 @@
// SBE is not ready to accept chip-ops,
// Skip the request, no additional error handling required.
log<level::INFO>(
- fmt::format("EnterMPIPL: Skipping ({}) on proc({})",
+ std::format("EnterMPIPL: Skipping ({}) on proc({})",
sbeError.what(), pdbg_target_index(tgt))
.c_str());
return;
}
- log<level::ERR>(fmt::format("EnterMPIPL failed({}) on proc({})",
+ log<level::ERR>(std::format("EnterMPIPL failed({}) on proc({})",
sbeError.what(), pdbg_target_index(tgt))
.c_str());
@@ -117,7 +117,7 @@
catch (const phalError_t& phalError)
{
// Failure reported
- log<level::ERR>(fmt::format("captureFFDC: Exception({}) on proc({})",
+ log<level::ERR>(std::format("captureFFDC: Exception({}) on proc({})",
phalError.what(), pdbg_target_index(tgt))
.c_str());
openpower::pel::createPEL(
@@ -126,7 +126,7 @@
}
log<level::INFO>(
- fmt::format("Enter MPIPL completed on proc({})", pdbg_target_index(tgt))
+ std::format("Enter MPIPL completed on proc({})", pdbg_target_index(tgt))
.c_str());
}
diff --git a/procedures/phal/import_devtree.cpp b/procedures/phal/import_devtree.cpp
index d1cff3e..78d45c2 100644
--- a/procedures/phal/import_devtree.cpp
+++ b/procedures/phal/import_devtree.cpp
@@ -4,7 +4,6 @@
#include "extensions/phal/pdbg_utils.hpp"
#include "registration.hpp"
-#include <fmt/format.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -14,6 +13,7 @@
#include <xyz/openbmc_project/Common/error.hpp>
#include <filesystem>
+#include <format>
namespace openpower
{
@@ -52,7 +52,7 @@
execl("/bin/sh", "sh", "-c", cmd.c_str(), 0);
auto error = errno;
- log<level::ERR>(fmt::format("Error occurred during attributes import "
+ log<level::ERR>(std::format("Error occurred during attributes import "
"execution, errno({})",
error)
.c_str());
@@ -84,7 +84,7 @@
}
catch (const fs::filesystem_error& e)
{ // Log message and continue. Data already applied successfully.
- log<level::ERR>(fmt::format("File({}) delete failed Error:({})",
+ log<level::ERR>(std::format("File({}) delete failed Error:({})",
DEVTREE_EXP_FILE, e.what())
.c_str());
}
diff --git a/procedures/phal/reinit_devtree.cpp b/procedures/phal/reinit_devtree.cpp
index 29b85c0..1e9918f 100644
--- a/procedures/phal/reinit_devtree.cpp
+++ b/procedures/phal/reinit_devtree.cpp
@@ -5,13 +5,13 @@
#include "temporary_file.hpp"
#include <fcntl.h>
-#include <fmt/format.h>
#include <nlohmann/json.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <cstdio>
#include <filesystem>
+#include <format>
extern "C"
{
@@ -44,7 +44,7 @@
if (ret)
{
log<level::ERR>(
- fmt::format("Failed({}) to update attribute override data", ret)
+ std::format("Failed({}) to update attribute override data", ret)
.c_str());
throw std::runtime_error(
"applyAttrOverride: dtree_cronus_import failed");
@@ -67,7 +67,7 @@
if (rwFileName.empty())
{
std::string err =
- fmt::format("Failed to read the target file "
+ std::format("Failed to read the target file "
"for the RW device tree symbolic link ({})",
CEC_DEVTREE_RW_PATH);
log<level::ERR>(err.c_str());
@@ -76,7 +76,7 @@
fs::path roFilePath = CEC_DEVTREE_RO_BASE_PATH / rwFileName;
if (!fs::exists(roFilePath))
{
- auto err = fmt::format("RO device tree file ({}) does not "
+ auto err = std::format("RO device tree file ({}) does not "
"exit ",
roFilePath.string());
log<level::ERR>(err.c_str());
@@ -130,7 +130,7 @@
if (!fs::exists(attrFile))
{
log<level::ERR>(
- fmt::format(
+ std::format(
"devtree attribute export list file is not available: ({})",
DEVTREE_REINIT_ATTRS_LIST)
.c_str());
@@ -147,7 +147,7 @@
if (fpExport.get() == nullptr)
{
log<level::ERR>(
- fmt::format("Temporary data file failed to open: ({})",
+ std::format("Temporary data file failed to open: ({})",
tmpFile.getPath().c_str())
.c_str());
throw std::runtime_error(
@@ -161,7 +161,7 @@
if (ret)
{
log<level::ERR>(
- fmt::format("Failed({}) to collect attribute export data",
+ std::format("Failed({}) to collect attribute export data",
ret)
.c_str());
throw std::runtime_error(
@@ -178,7 +178,7 @@
if (fpImport.get() == nullptr)
{
log<level::ERR>(
- fmt::format("import, temporary data file failed to open: ({})",
+ std::format("import, temporary data file failed to open: ({})",
tmpFile.getPath().c_str())
.c_str());
throw std::runtime_error(
@@ -191,7 +191,7 @@
if (ret)
{
log<level::ERR>(
- fmt::format("Failed({}) to update attribute data", ret)
+ std::format("Failed({}) to update attribute data", ret)
.c_str());
throw std::runtime_error(
"reinitDevtree: dtree_cronus_import function failed");
@@ -207,7 +207,7 @@
// Any failures during temporary file re-init should create PEL
// and continue with current version of devtree file to allow boot.
log<level::ERR>(
- fmt::format("reinitDevtree failed ({})", e.what()).c_str());
+ std::format("reinitDevtree failed ({})", e.what()).c_str());
json jsonCalloutDataList;
jsonCalloutDataList = json::array();
json jsonCalloutData;
@@ -245,7 +245,7 @@
// PEL, with code callout. Also failed the service.
// and continue with current version of devtree file to allow boot.
log<level::ERR>(
- fmt::format("reinitDevtree r/w version update failed ({})",
+ std::format("reinitDevtree r/w version update failed ({})",
e.what())
.c_str());
json jsonCalloutDataList;
diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp
index c0c0fd6..e6f01ec 100644
--- a/procedures/phal/start_host.cpp
+++ b/procedures/phal/start_host.cpp
@@ -10,7 +10,6 @@
#include "extensions/phal/phal_error.hpp"
#include "util.hpp"
-#include <fmt/format.h>
#include <libekb.H>
#include <ext_interface.hpp>
@@ -18,6 +17,8 @@
#include <phosphor-logging/log.hpp>
#include <registration.hpp>
+#include <format>
+
namespace openpower
{
namespace phal
@@ -131,13 +132,13 @@
if (hwKwdSize != hwData.size())
{
log<level::ERR>(
- fmt::format("Incorrect VINI records HW Keyword data size({})",
+ std::format("Incorrect VINI records HW Keyword data size({})",
hwData.size())
.c_str());
throw std::runtime_error("Incorrect VINI records HW Keyword data size");
}
- log<level::DEBUG>(fmt::format("VINI Records HW[0]:{} HW[1]:{}",
+ log<level::DEBUG>(std::format("VINI Records HW[0]:{} HW[1]:{}",
hwData.at(0), hwData.at(1))
.c_str());
@@ -206,7 +207,7 @@
// Don't throw exception since the caller might call in the error path
// and even we should allow the hardware isolation by default.
log<level::ERR>(
- fmt::format("Exception [{}], failed to create the error log "
+ std::format("Exception [{}], failed to create the error log "
"for the hardware isolation policy settings failures.",
e.what())
.c_str());
@@ -252,7 +253,7 @@
}
else
{
- const auto trace{fmt::format(
+ const auto trace{std::format(
"Failed to read the HardwareIsolation policy "
"from the path [{}] interface [{}]. Continuing with "
"default mode(allow_hw_isolation)",
@@ -265,7 +266,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- const auto trace{fmt::format(
+ const auto trace{std::format(
"Exception [{}] to get the HardwareIsolation policy "
"from the path [{}] interface [{}]. Continuing with "
"default mode (allow_hw_isolation)",
diff --git a/procedures/phal/thread_stopall.cpp b/procedures/phal/thread_stopall.cpp
index 0355eb2..b29bb30 100644
--- a/procedures/phal/thread_stopall.cpp
+++ b/procedures/phal/thread_stopall.cpp
@@ -3,10 +3,11 @@
#include "registration.hpp"
#include <attributes_info.H>
-#include <fmt/format.h>
#include <libipl.H>
#include <libphal.H>
#include <phal_exception.H>
+
+#include <format>
extern "C"
{
#include <libpdbg.h>
@@ -55,7 +56,7 @@
if (DT_GET_PROP(ATTR_HWAS_STATE, procTarget, hwasState))
{
log<level::ERR>(
- fmt::format("({})Could not read HWAS_STATE attribute",
+ std::format("({})Could not read HWAS_STATE attribute",
pdbg_target_path(procTarget))
.c_str());
continue;
@@ -77,7 +78,7 @@
if (errType == SBE_CMD_FAILED)
{
log<level::ERR>(
- fmt::format(
+ std::format(
"threadStopAll failed({}) on proc({})",
static_cast<
std::underlying_type<ipl_error_type>::type>(
@@ -105,7 +106,7 @@
// SBE is not ready to accept chip-ops,
// Skip the request, no additional error handling required.
log<level::INFO>(
- fmt::format("threadStopAll: Skipping ({}) on proc({})",
+ std::format("threadStopAll: Skipping ({}) on proc({})",
sbeError.what(),
pdbg_target_index(procTarget))
.c_str());
@@ -113,7 +114,7 @@
continue;
}
log<level::INFO>(
- fmt::format("Processor thread stopall completed on proc({})",
+ std::format("Processor thread stopall completed on proc({})",
pdbg_target_index(procTarget))
.c_str());
}
@@ -125,7 +126,7 @@
// Dont throw exception on failure because, need to proceed
// further to complete power-off/reboot.
log<level::ERR>(
- fmt::format("threadStopAll: Exception({})", ex.what()).c_str());
+ std::format("threadStopAll: Exception({})", ex.what()).c_str());
// To store additional data about ffdc.
FFDCData pelAdditionalData;
diff --git a/temporary_file.cpp b/temporary_file.cpp
index 885b5ff..6352736 100644
--- a/temporary_file.cpp
+++ b/temporary_file.cpp
@@ -1,6 +1,5 @@
#include "temporary_file.hpp"
-#include <fmt/format.h>
#include <unistd.h>
#include <phosphor-logging/elog-errors.hpp>
diff --git a/util.cpp b/util.cpp
index aac2a00..e03f965 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,9 +1,8 @@
#include "util.hpp"
-#include <fmt/format.h>
-
#include <phosphor-logging/elog.hpp>
+#include <format>
#include <sstream>
#include <variant>
#include <vector>
@@ -31,7 +30,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(fmt::format("D-Bus call exception OBJPATH={}"
+ log<level::ERR>(std::format("D-Bus call exception OBJPATH={}"
"INTERFACE={} EXCEPTION={}",
objectPath, interface, e.what())
.c_str());
@@ -67,7 +66,7 @@
const std::string* state = std::get_if<std::string>(&retval);
if (state == nullptr)
{
- std::string err = fmt::format(
+ std::string err = std::format(
"CurrentHostState property is not set ({})", object);
log<level::ERR>(err.c_str());
return false;
@@ -85,7 +84,7 @@
catch (const std::exception& ex)
{
log<level::ERR>(
- fmt::format("Failed to read CurrentHostState property ({})",
+ std::format("Failed to read CurrentHostState property ({})",
ex.what())
.c_str());
}
@@ -116,12 +115,12 @@
catch (const std::exception& ex)
{
log<level::ERR>(
- fmt::format("Failed to read CurrentPowerState property ({})",
+ std::format("Failed to read CurrentPowerState property ({})",
ex.what())
.c_str());
}
- log<level::DEBUG>(fmt::format("Power state is: {} ", powerState).c_str());
+ log<level::DEBUG>(std::format("Power state is: {} ", powerState).c_str());
return powerState;
}