cleanup fmt::format for std::format

Update the code to use std::format since gcc13 supports it now. Also
cleaned up some unused headers.

Change-Id: Ief2ad4df9e8b8227168f4f98213da8b3978fda03
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/subprojects/ncsid/src/ncsi_state_machine.cpp b/subprojects/ncsid/src/ncsi_state_machine.cpp
index 40e78e7..b2e0286 100644
--- a/subprojects/ncsid/src/ncsi_state_machine.cpp
+++ b/subprojects/ncsid/src/ncsi_state_machine.cpp
@@ -19,7 +19,6 @@
 #include "platforms/nemora/portable/ncsi_fsm.h"
 
 #include <arpa/inet.h>
-#include <fmt/format.h>
 #include <fmt/printf.h>
 #include <netinet/ether.h>
 #include <unistd.h>
@@ -28,7 +27,6 @@
 #include <cstdint>
 #include <cstdlib>
 #include <cstring>
-#include <iostream>
 #include <string>
 #include <thread>
 #include <utility>
diff --git a/subprojects/ncsid/src/net_config.cpp b/subprojects/ncsid/src/net_config.cpp
index e9b390b..8316837 100644
--- a/subprojects/ncsid/src/net_config.cpp
+++ b/subprojects/ncsid/src/net_config.cpp
@@ -14,7 +14,6 @@
 
 #include "net_config.h"
 
-#include <fmt/format.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
@@ -27,6 +26,7 @@
 #include <cstdio>
 #include <cstring>
 #include <filesystem>
+#include <format>
 #include <utility>
 #include <variant>
 
@@ -138,16 +138,16 @@
 
     try
     {
-        auto netdir = fmt::format("/run/systemd/network/00-bmc-{}.network.d",
+        auto netdir = std::format("/run/systemd/network/00-bmc-{}.network.d",
                                   iface_name_);
         std::filesystem::create_directories(netdir);
-        auto netfile = fmt::format("{}/60-ncsi-mac.conf", netdir);
+        auto netfile = std::format("{}/60-ncsi-mac.conf", netdir);
         auto fd = stdplus::fd::open(
             netfile,
             stdplus::fd::OpenFlags(stdplus::fd::OpenAccess::WriteOnly)
                 .set(stdplus::fd::OpenFlag::Create),
             0644);
-        auto contents = fmt::format("[Link]\nMACAddress={}\n",
+        auto contents = std::format("[Link]\nMACAddress={}\n",
                                     std::get<std::string>(mac_value));
         stdplus::fd::writeExact(fd, contents);
     }
diff --git a/subprojects/nemora-postd/meson.build b/subprojects/nemora-postd/meson.build
index b1c8921..21f8421 100644
--- a/subprojects/nemora-postd/meson.build
+++ b/subprojects/nemora-postd/meson.build
@@ -28,7 +28,6 @@
 sdbusplus = dependency('sdbusplus')
 threads = dependency('threads')
 logging = dependency('phosphor-logging')
-fmt = declare_dependency(compile_args: '-DFMT_STRING_ALIAS=1', dependencies: dependency('fmt'))
 
 protoc = find_program('protoc', native: true)
 
@@ -55,7 +54,7 @@
   'src/serializer.cpp',
   proto,
   include_directories: include_directories('.'),
-  dependencies: [protobuf, phosphor_dbus_interfaces, sdbusplus, threads, logging, fmt],
+  dependencies: [protobuf, phosphor_dbus_interfaces, sdbusplus, threads, logging],
   install: true
 )
 
diff --git a/subprojects/nemora-postd/nemorad.cpp b/subprojects/nemora-postd/nemorad.cpp
index 33a034a..0ad8010 100644
--- a/subprojects/nemora-postd/nemorad.cpp
+++ b/subprojects/nemora-postd/nemorad.cpp
@@ -18,21 +18,18 @@
 #include "src/nemora.hpp"
 
 #include <arpa/inet.h>
-#include <fmt/format.h>
 
 #include <CLI/CLI.hpp>
 #include <phosphor-logging/log.hpp>
 
 #include <csignal>
 #include <cstdint>
-#include <iostream>
 #include <regex>
 #include <string>
 #include <thread>
 #include <unordered_map>
 #include <vector>
 
-using fmt::format;
 using phosphor::logging::level;
 using phosphor::logging::log;
 
diff --git a/subprojects/nemora-postd/src/host_manager.cpp b/subprojects/nemora-postd/src/host_manager.cpp
index eb0a2b9..b771146 100644
--- a/subprojects/nemora-postd/src/host_manager.cpp
+++ b/subprojects/nemora-postd/src/host_manager.cpp
@@ -14,17 +14,14 @@
 
 #include "host_manager.hpp"
 
-#include <fmt/format.h>
-
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/message.hpp>
 
+#include <format>
 #include <functional>
-#include <iostream>
 #include <variant>
 
-using fmt::format;
 using phosphor::logging::level;
 using phosphor::logging::log;
 
@@ -79,7 +76,7 @@
     auto count = postcodes_.size();
     if (count > 0)
     {
-        std::string msg = format("Draining Postcodes. Count: {}.", count);
+        std::string msg = std::format("Draining Postcodes. Count: {}.", count);
         log<level::ERR>(msg.c_str());
     }
 
diff --git a/subprojects/nemora-postd/src/serializer.cpp b/subprojects/nemora-postd/src/serializer.cpp
index 69324d9..f87d6d2 100644
--- a/subprojects/nemora-postd/src/serializer.cpp
+++ b/subprojects/nemora-postd/src/serializer.cpp
@@ -16,11 +16,10 @@
 
 #include "event_message.pb.h"
 
-#include <fmt/format.h>
-
 #include <phosphor-logging/log.hpp>
 
-using fmt::format;
+#include <format>
+
 using phosphor::logging::level;
 using phosphor::logging::log;
 
@@ -34,9 +33,9 @@
             break;
         default:
             log<level::ERR>(
-                format("Type with ID {} not supported by "
-                       "Serializer::Serialize(const NemoraDatagram*)",
-                       static_cast<int>(dgram->type))
+                std::format("Type with ID {} not supported by "
+                            "Serializer::Serialize(const NemoraDatagram*)",
+                            static_cast<int>(dgram->type))
                     .c_str());
     }
 
@@ -64,7 +63,7 @@
         platforms::nemora::proto::EventSeries::NATIVE_32_BIT);
 
     log<level::INFO>(
-        format("NemoraEvent {}", pb.DebugString().c_str()).c_str());
+        std::format("NemoraEvent {}", pb.DebugString().c_str()).c_str());
     pb.SerializeToString(&result);
     return result;
 }
diff --git a/subprojects/nemora-postd/src/socket_manager.cpp b/subprojects/nemora-postd/src/socket_manager.cpp
index 13f3269..884e1d6 100644
--- a/subprojects/nemora-postd/src/socket_manager.cpp
+++ b/subprojects/nemora-postd/src/socket_manager.cpp
@@ -17,15 +17,14 @@
 #include "serializer.hpp"
 
 #include <errno.h>
-#include <fmt/format.h>
 #include <sys/socket.h>
 #include <unistd.h>
 
 #include <phosphor-logging/log.hpp>
 
 #include <cstring>
+#include <format>
 
-using fmt::format;
 using phosphor::logging::level;
 using phosphor::logging::log;
 
@@ -59,10 +58,11 @@
                       sizeof(bcast->destination6));
     if (err < 0)
     {
-        log<level::ERR>(format("SocketManager::SendDatagram: Couldn't sendto "
-                               "socket (IPv6): {}",
-                               std::strerror(errno))
-                            .c_str());
+        log<level::ERR>(
+            std::format("SocketManager::SendDatagram: Couldn't sendto "
+                        "socket (IPv6): {}",
+                        std::strerror(errno))
+                .c_str());
     }
 
     // Send serialized data (v4)
@@ -71,10 +71,11 @@
                  sizeof(bcast->destination));
     if (err < 0)
     {
-        log<level::ERR>(format("SocketManager::SendDatagram: Couldn't sendto "
-                               "socket (IPv4): {}",
-                               std::strerror(errno))
-                            .c_str());
+        log<level::ERR>(
+            std::format("SocketManager::SendDatagram: Couldn't sendto "
+                        "socket (IPv4): {}",
+                        std::strerror(errno))
+                .c_str());
     }
 
     CloseSocketSafely(fd);