PEL: 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: I89f0a5b67bbfe54168a20e93c989a1ae87f54503
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/extensions/openpower-pels/fapi_data_process.cpp b/extensions/openpower-pels/fapi_data_process.cpp
index a658449..13416ae 100644
--- a/extensions/openpower-pels/fapi_data_process.cpp
+++ b/extensions/openpower-pels/fapi_data_process.cpp
@@ -6,7 +6,6 @@
#include "fapi_data_process.hpp"
#include <attributes_info.H>
-#include <fmt/format.h>
#include <libphal.H>
#include <phal_exception.H>
@@ -15,6 +14,7 @@
#include <algorithm>
#include <cstdlib>
#include <cstring>
+#include <format>
#include <iomanip>
#include <list>
#include <map>
@@ -120,7 +120,7 @@
catch (const std::exception& e)
{
// log message and continue with default data
- log<level::ERR>(fmt::format("getLocationCode({}): Exception({})",
+ log<level::ERR>(std::format("getLocationCode({}): Exception({})",
pdbg_target_path(target), e.what())
.c_str());
}
@@ -128,14 +128,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());
}
@@ -167,9 +167,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;
}
@@ -202,7 +208,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());
@@ -256,7 +262,7 @@
FFDCData& ffdcUserData)
{
log<level::INFO>(
- fmt::format("processClockInfoErrorHelper: FFDC Message[{}]",
+ std::format("processClockInfoErrorHelper: FFDC Message[{}]",
ffdc.message)
.c_str());
@@ -470,7 +476,7 @@
else if ((ffdc.ffdc_type != FFDC_TYPE_NONE) &&
(ffdc.ffdc_type != FFDC_TYPE_UNSUPPORTED))
{
- log<level::ERR>(fmt::format("Unsupported phal FFDC type to create PEL. "
+ log<level::ERR>(std::format("Unsupported phal FFDC type to create PEL. "
"MSG: {}",
ffdc.message)
.c_str());