src: remove bool debug

Follow-up commit to the lg2 conversion.

Patching is not needed to get debug logs with lg2.

Tested: Inspection only.

Change-Id: Ie44b2debc7f4dff3a431a15f53720ae2da044a68
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/external/ExternalSensor.cpp b/src/external/ExternalSensor.cpp
index 51a439a..4a3b369 100644
--- a/src/external/ExternalSensor.cpp
+++ b/src/external/ExternalSensor.cpp
@@ -20,8 +20,6 @@
 #include <utility>
 #include <vector>
 
-static constexpr bool debug = false;
-
 ExternalSensor::ExternalSensor(
     const std::string& objectType, sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& conn,
@@ -64,16 +62,13 @@
         objectServer.add_interface(objectPath, association::interface);
     setInitialProperties(sensorUnits);
 
-    if constexpr (debug)
-    {
-        lg2::error(
-            "ExternalSensor '{NAME}' constructed: path '{PATH}', type '{TYPE}', "
-            "min '{MIN}', max '{MAX}', timeout '{TIMEOUT}' us",
-            "NAME", name, "PATH", objectPath, "TYPE", objectType, "MIN",
-            minReading, "MAX", maxReading, "TIMEOUT",
-            std::chrono::duration_cast<std::chrono::microseconds>(writeTimeout)
-                .count());
-    }
+    lg2::debug(
+        "ExternalSensor '{NAME}' constructed: path '{PATH}', type '{TYPE}', "
+        "min '{MIN}', max '{MAX}', timeout '{TIMEOUT}' us",
+        "NAME", name, "PATH", objectPath, "TYPE", objectType, "MIN", minReading,
+        "MAX", maxReading, "TIMEOUT",
+        std::chrono::duration_cast<std::chrono::microseconds>(writeTimeout)
+            .count());
 }
 
 // Separate function from constructor, because of a gotcha: can't use the
@@ -94,10 +89,7 @@
             lockThis->externalSetTrigger();
             return;
         }
-        if constexpr (debug)
-        {
-            lg2::error("ExternalSensor receive ignored, sensor gone");
-        }
+        lg2::debug("ExternalSensor receive ignored, sensor gone");
     };
 }
 
@@ -113,10 +105,7 @@
     }
     objServer.remove_interface(sensorInterface);
 
-    if constexpr (debug)
-    {
-        lg2::error("ExternalSensor '{NAME}' destructed", "NAME", name);
-    }
+    lg2::debug("ExternalSensor '{NAME}' destructed", "NAME", name);
 }
 
 void ExternalSensor::checkThresholds()
@@ -190,11 +179,8 @@
 
 void ExternalSensor::externalSetTrigger()
 {
-    if constexpr (debug)
-    {
-        lg2::error("ExternalSensor '{NAME}' received '{VALUE}'", "NAME", name,
-                   "VALUE", value);
-    }
+    lg2::debug("ExternalSensor '{NAME}' received '{VALUE}'", "NAME", name,
+               "VALUE", value);
 
     if (std::isfinite(value))
     {
diff --git a/src/external/ExternalSensorMain.cpp b/src/external/ExternalSensorMain.cpp
index c8b21b4..04edb4f 100644
--- a/src/external/ExternalSensorMain.cpp
+++ b/src/external/ExternalSensorMain.cpp
@@ -55,8 +55,6 @@
 // https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/41452
 // https://github.com/openbmc/docs/tree/master/designs/
 
-static constexpr bool debug = false;
-
 static const char* sensorType = "ExternalSensor";
 
 void updateReaper(
@@ -117,10 +115,7 @@
 
     if (!needCheck)
     {
-        if constexpr (debug)
-        {
-            lg2::error("Next ExternalSensor timer idle");
-        }
+        lg2::debug("Next ExternalSensor timer idle");
 
         return;
     }
@@ -143,13 +138,9 @@
         updateReaper(sensors, timer, std::chrono::steady_clock::now());
     });
 
-    if constexpr (debug)
-    {
-        lg2::error(
-            "Next ExternalSensor timer '{VALUE}' us", "VALUE",
-            std::chrono::duration_cast<std::chrono::microseconds>(nextCheck)
-                .count());
-    }
+    lg2::debug("Next ExternalSensor timer '{VALUE}' us", "VALUE",
+               std::chrono::duration_cast<std::chrono::microseconds>(nextCheck)
+                   .count());
 }
 
 void createSensors(
@@ -161,10 +152,7 @@
         sensorsChanged,
     boost::asio::steady_timer& reaperTimer)
 {
-    if constexpr (debug)
-    {
-        lg2::error("ExternalSensor considering creating sensors");
-    }
+    lg2::debug("ExternalSensor considering creating sensors");
 
     auto getter = std::make_shared<GetSensorConfiguration>(
         dbusConnection,
@@ -293,12 +281,8 @@
                             sensorsChanged->erase(it);
                             findSensor->second = nullptr;
                             found = true;
-                            if constexpr (debug)
-                            {
-                                lg2::error(
-                                    "ExternalSensor '{NAME}' change found",
-                                    "NAME", sensorName);
-                            }
+                            lg2::debug("ExternalSensor '{NAME}' change found",
+                                       "NAME", sensorName);
                             break;
                         }
                     }
@@ -330,11 +314,8 @@
                         updateReaper(sensors, reaperTimer, now);
                     });
 
-                if constexpr (debug)
-                {
-                    lg2::error("ExternalSensor '{NAME}' created", "NAME",
-                               sensorName);
-                }
+                lg2::debug("ExternalSensor '{NAME}' created", "NAME",
+                           sensorName);
             }
         });
 
@@ -343,10 +324,7 @@
 
 int main()
 {
-    if constexpr (debug)
-    {
-        lg2::error("ExternalSensor service starting up");
-    }
+    lg2::debug("ExternalSensor service starting up");
 
     boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
@@ -378,11 +356,8 @@
 
             const auto* messagePath = message.get_path();
             sensorsChanged->insert(messagePath);
-            if constexpr (debug)
-            {
-                lg2::error("ExternalSensor change event received: '{PATH}'",
-                           "PATH", messagePath);
-            }
+            lg2::debug("ExternalSensor change event received: '{PATH}'", "PATH",
+                       messagePath);
 
             // this implicitly cancels the timer
             filterTimer.expires_after(std::chrono::seconds(1));
@@ -409,10 +384,7 @@
         setupPropertiesChangedMatches(
             *systemBus, std::to_array<const char*>({sensorType}), eventHandler);
 
-    if constexpr (debug)
-    {
-        lg2::error("ExternalSensor service entering main loop");
-    }
+    lg2::debug("ExternalSensor service entering main loop");
 
     io.run();
 }