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