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/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;
}