logging: switch to lg2

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If28e6c9c7ae4eae5d17d28e055c90a04750834ac
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 3b47fd6..cdf1d97 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -2,9 +2,8 @@
 #include "exprtkTools.hpp"
 #include "thresholds.hpp"
 
-#include <fmt/format.h>
-
 #include <nlohmann/json.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/bus.hpp>
 #include <xyz/openbmc_project/Association/Definitions/server.hpp>
 #include <xyz/openbmc_project/Sensor/Value/server.hpp>
@@ -17,6 +16,8 @@
 namespace virtualSensor
 {
 
+PHOSPHOR_LOG2_USING_WITH_FLAGS;
+
 using BasicVariantType =
     std::variant<std::string, int64_t, uint64_t, double, int32_t, uint32_t,
                  int16_t, uint16_t, uint8_t, bool, std::vector<std::string>>;
@@ -205,16 +206,16 @@
         {
             if (!alarmHigh)
             {
-                constexpr auto msg =
-                    "ASSERT: {} has exceeded the {} high threshold";
-                log<level::ERR>(fmt::format(msg, name, tname).c_str());
+                error("ASSERT: sensor {SENSOR} is above the upper threshold "
+                      "{THRESHOLD}.",
+                      "SENSOR", name, "THRESHOLD", tname);
                 threshold->alarmHighSignalAsserted(value);
             }
             else
             {
-                constexpr auto msg =
-                    "DEASSERT: {} is under the {} high threshold";
-                log<level::INFO>(fmt::format(msg, name, tname).c_str());
+                info("DEASSERT: sensor {SENSOR} is under the upper threshold "
+                     "{THRESHOLD}.",
+                     "SENSOR", name, "THRESHOLD", tname);
                 threshold->alarmHighSignalDeasserted(value);
             }
             threshold->alarmHigh(!alarmHigh);
@@ -227,15 +228,16 @@
         {
             if (!alarmLow)
             {
-                constexpr auto msg = "ASSERT: {} is under the {} low threshold";
-                log<level::ERR>(fmt::format(msg, name, tname).c_str());
+                error("ASSERT: sensor {SENSOR} is below the lower threshold "
+                      "{THRESHOLD}.",
+                      "SENSOR", name, "THRESHOLD", tname);
                 threshold->alarmLowSignalAsserted(value);
             }
             else
             {
-                constexpr auto msg =
-                    "DEASSERT: {} is above the {} low threshold";
-                log<level::INFO>(fmt::format(msg, name, tname).c_str());
+                info("DEASSERT: sensor {SENSOR} is above the lower threshold "
+                     "{THRESHOLD}.",
+                     "SENSOR", name, "THRESHOLD", tname);
                 threshold->alarmLowSignalDeasserted(value);
             }
             threshold->alarmLow(!alarmLow);