switch fmt::format to use std::format

The fmt::format is supported directly in std now.  Swap it out and
remove the unnecessary dependency.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie278c6328239928198fd87f5007468d401e44a21
diff --git a/meson.build b/meson.build
index 8a272a4..dcff46e 100644
--- a/meson.build
+++ b/meson.build
@@ -29,19 +29,6 @@
     ]
 )
 
-fmt_dep = dependency('fmt', required: false)
-if not fmt_dep.found()
-  fmt_proj = import('cmake').subproject(
-    'fmt',
-    cmake_options: [
-      '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
-      '-DMASTER_PROJECT=OFF'
-    ],
-    required: false)
-  assert(fmt_proj.found(), 'fmtlib is required')
-  fmt_dep = fmt_proj.dependency('fmt')
-endif
-
 realpath_prog = find_program('realpath')
 
 selected_subdirs = []
@@ -102,7 +89,6 @@
     systemd,
     sdbusplus_dep,
     phosphorlogging,
-    fmt_dep,
     extra_deps
 ]
 
diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap
deleted file mode 100644
index 6847ae5..0000000
--- a/subprojects/fmt.wrap
+++ /dev/null
@@ -1,3 +0,0 @@
-[wrap-git]
-url = https://github.com/fmtlib/fmt
-revision = HEAD
diff --git a/watchdog/ffdc_file.cpp b/watchdog/ffdc_file.cpp
index 0086e2f..bcc016f 100644
--- a/watchdog/ffdc_file.cpp
+++ b/watchdog/ffdc_file.cpp
@@ -2,13 +2,13 @@
 
 #include <errno.h>     // for errno
 #include <fcntl.h>     // for open()
-#include <fmt/format.h>
 #include <string.h>    // for strerror()
 #include <sys/stat.h>  // for open()
 #include <sys/types.h> // for open()
 
 #include <phosphor-logging/log.hpp>
 
+#include <format>
 #include <stdexcept>
 #include <string>
 
@@ -29,7 +29,7 @@
     // Close file descriptor.  Does nothing if descriptor was already closed.
     if (descriptor.close() == -1)
     {
-        log<level::ERR>(fmt::format("Unable to close FFDC file: errormsg({})",
+        log<level::ERR>(std::format("Unable to close FFDC file: errormsg({})",
                                     strerror(errno))
                             .c_str());
     }
@@ -52,7 +52,7 @@
 
     if (rc == -1)
     {
-        log<level::ERR>(fmt::format("Failed to write callout info "
+        log<level::ERR>(std::format("Failed to write callout info "
                                     "in file({}), errorno({}), errormsg({})",
                                     tempFile.getPath().c_str(), errno,
                                     strerror(errno))
@@ -61,7 +61,7 @@
     }
     else if (rc != static_cast<ssize_t>(calloutData.size()))
     {
-        log<level::WARNING>(fmt::format("Could not write all callout "
+        log<level::WARNING>(std::format("Could not write all callout "
                                         "info in file({}), written byte({}) "
                                         "and total byte({})",
                                         tempFile.getPath().c_str(), rc,
@@ -74,7 +74,7 @@
     if (retCode == -1)
     {
         log<level::ERR>(
-            fmt::format("Failed to seek file postion to the beginning"
+            std::format("Failed to seek file postion to the beginning"
                         "in file({}), errorno({}) "
                         "and errormsg({})",
                         tempFile.getPath().c_str(), errno, strerror(errno))
diff --git a/watchdog/watchdog_dbus.cpp b/watchdog/watchdog_dbus.cpp
index 4512ab0..1606be1 100644
--- a/watchdog/watchdog_dbus.cpp
+++ b/watchdog/watchdog_dbus.cpp
@@ -1,10 +1,10 @@
-#include <fmt/format.h>
 #include <unistd.h>
 
 #include <phosphor-logging/log.hpp>
 #include <watchdog_dbus.hpp>
 #include <watchdog_logging.hpp>
 
+#include <format>
 #include <string>
 #include <vector>
 
@@ -160,7 +160,7 @@
         catch (const sdbusplus::exception_t& e)
         {
             log<level::ERR>(
-                fmt::format("Failed to read CurrentHostState property ({})",
+                std::format("Failed to read CurrentHostState property ({})",
                             e.what())
                     .c_str());
         }
diff --git a/watchdog/watchdog_handler.cpp b/watchdog/watchdog_handler.cpp
index 78008ac..c4afb2a 100644
--- a/watchdog/watchdog_handler.cpp
+++ b/watchdog/watchdog_handler.cpp
@@ -1,5 +1,3 @@
-#include <fmt/format.h>
-
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/bus/match.hpp>
@@ -7,6 +5,8 @@
 #include <watchdog_handler.hpp>
 #include <watchdog_logging.hpp>
 
+#include <format>
+
 namespace watchdog
 {
 namespace dump
@@ -173,7 +173,7 @@
             {
                 // Dump is disabled, Skip the dump collection.
                 log<level::INFO>(
-                    fmt::format(
+                    std::format(
                         "Dump is disabled on({}), skipping dump collection",
                         dumpParameters.unitId)
                         .c_str());
@@ -181,7 +181,7 @@
             else
             {
                 log<level::ERR>(
-                    fmt::format("D-Bus call createDump exception ",
+                    std::format("D-Bus call createDump exception ",
                                 "OBJPATH={}, INTERFACE={}, EXCEPTION={}", path,
                                 interface, e.what())
                         .c_str());
diff --git a/watchdog/watchdog_main.cpp b/watchdog/watchdog_main.cpp
index 00f7830..7ad1ced 100644
--- a/watchdog/watchdog_main.cpp
+++ b/watchdog/watchdog_main.cpp
@@ -1,4 +1,4 @@
-#include <fmt/format.h>
+#include <format>
 extern "C"
 {
 #include <libpdbg.h>
@@ -71,7 +71,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());
     }
@@ -93,7 +93,7 @@
     {
         // Failed to collect FFDC information
         log<level::ERR>(
-            fmt::format("captureFFDC: Exception{}", e.what()).c_str());
+            std::format("captureFFDC: Exception{}", e.what()).c_str());
         dumpIsRequired = true;
     }
 
@@ -157,7 +157,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());
     }
@@ -182,7 +182,7 @@
         catch (const std::exception& e)
         {
             log<level::ERR>(
-                fmt::format("Exception {} occurred", e.what()).c_str());
+                std::format("Exception {} occurred", e.what()).c_str());
             return;
         }
 
diff --git a/watchdog_timeout.cpp b/watchdog_timeout.cpp
index dbebc1e..36c6e66 100644
--- a/watchdog_timeout.cpp
+++ b/watchdog_timeout.cpp
@@ -9,13 +9,14 @@
 #include <libpdbg_sbe.h>
 }
 
-#include <fmt/format.h>
 #include <libphal.H>
 
 #include <phosphor-logging/log.hpp>
 #include <watchdog/watchdog_common.hpp>
 #include <watchdog/watchdog_dbus.hpp>
 #include <watchdog/watchdog_main.hpp>
+
+#include <format>
 #else
 #include "org/open_power/Host/Boot/error.hpp"
 #include "phosphor-logging/elog-errors.hpp"
@@ -77,7 +78,7 @@
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>(fmt::format("Exception {} occurred", e.what()).c_str());
+        log<level::ERR>(std::format("Exception {} occurred", e.what()).c_str());
         std::string eventType =
             "org.open_power.Host.Boot.Error.WatchdogTimedOut";
         auto ffdc = std::vector<FFDCTuple>{};