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))
{