Move the control application to lg2
Update the logging API used for files in phosphor-fan-presence/control
from the older phosphor::logging::log to the more recent lg2::log.
Tested:
* Verified journal traces worked correctly in simulation.
* Modified json to force various property errors and verified
correct key/value pairs in the journalctl output.
Change-Id: If1ac33b90abe2a9baae6f3cc788863bd514fa80e
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/control/json/triggers/parameter.cpp b/control/json/triggers/parameter.cpp
index 1bec051..5a2d59f 100644
--- a/control/json/triggers/parameter.cpp
+++ b/control/json/triggers/parameter.cpp
@@ -17,7 +17,7 @@
#include "../manager.hpp"
-#include <format>
+#include <phosphor-logging/lg2.hpp>
namespace phosphor::fan::control::json::trigger::parameter
{
@@ -30,10 +30,11 @@
{
if (!jsonObj.contains("parameter"))
{
- auto msg = std::format(
- "Event '{}' parameter trigger is missing 'parameter'", eventName);
- log<level::ERR>(msg.c_str());
- throw std::runtime_error(msg);
+ lg2::error(
+ "Event '{EVENT_NAME}' parameter trigger is missing 'parameter'",
+ "EVENT_NAME", eventName);
+ throw std::runtime_error(
+ "Event parameter trigger is missing 'parameter'");
}
auto name = jsonObj["parameter"].get<std::string>();