Move the presence application to lg2
Update the logging API used for files in phosphor-fan-presence/presence
from the older phosphor::logging::log to the more recent lg2::log.
Tested:
* Verified info and error messages worked correctly in simulation.
* Modified json file to force various property errors and verified
key/value pairs were correct in the journalctl output.
Change-Id: Id4eb226d299fb971aacf3fffcf5036753d274cf8
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/presence/fallback.cpp b/presence/fallback.cpp
index b3fc54a..61a0192 100644
--- a/presence/fallback.cpp
+++ b/presence/fallback.cpp
@@ -18,10 +18,9 @@
#include "fan.hpp"
#include "psensor.hpp"
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <algorithm>
-#include <format>
namespace phosphor
{
@@ -52,10 +51,8 @@
activeSensor->get().fail();
++activeSensor;
}
- phosphor::logging::log<phosphor::logging::level::INFO>(
- std::format("Using backup presence sensor for fan {}",
- std::get<1>(fan))
- .c_str());
+ lg2::info("Using backup presence sensor for fan {FAN}", "FAN",
+ std::get<1>(fan));
activeSensor = it;
}
}
@@ -91,10 +88,8 @@
if (activeSensor != sensors.begin())
{
- phosphor::logging::log<phosphor::logging::level::INFO>(
- std::format("Using backup presence sensor for fan {}",
- std::get<1>(fan))
- .c_str());
+ lg2::info("Using backup presence sensor for fan {FAN}", "FAN",
+ std::get<1>(fan));
}
// Callout the broken sensors.