Use format_as rather than operator << overload

format_as seems to be the preferred way to handle enums
according to fmtlib documentation.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Change-Id: I46946b711468d8bd572669a7b182e6df2326f757
diff --git a/occ_command.hpp b/occ_command.hpp
index 6f0c056..b3983ff 100644
--- a/occ_command.hpp
+++ b/occ_command.hpp
@@ -3,7 +3,7 @@
 #include "occ_errors.hpp"
 #include "utils.hpp"
 
-#include <fmt/ostream.h>
+#include <fmt/format.h>
 
 #include <org/open_power/OCC/PassThrough/server.hpp>
 #include <sdbusplus/bus.hpp>
@@ -57,6 +57,11 @@
     MAX_PERF = 0x0C      // Maximum Performance
 };
 
+static inline auto format_as(SysPwrMode spm)
+{
+    return fmt::underlying(spm);
+}
+
 // Only some of the SysPwrModes are currently supported and allowed to be set
 #define VALID_POWER_MODE_SETTING(mode)                                         \
     ((mode == SysPwrMode::STATIC) || (mode == SysPwrMode::POWER_SAVING) ||     \
@@ -85,6 +90,11 @@
     COMM_FAILURE = 0x03
 };
 
+static inline auto format_as(CmdStatus cs)
+{
+    return fmt::underlying(cs);
+}
+
 /** @brief Trace block of data in hex with log<level:INFO>
  *
  *  @param[in] data - vector containing data to trace
@@ -173,7 +183,3 @@
 
 } // namespace occ
 } // namespace open_power
-
-template <>
-struct fmt::formatter<open_power::occ::SysPwrMode> : ostream_formatter
-{};