Move the monitor application to lg2
Update the logging API used for files in phosphor-fan-presence/monitor
from the older phosphor::logging::log to the more recent lg2::log.
Tested:
* Verified journal traces worked correctly in simulation.
* Modified json and simulation parameters to force various
application errors and verified correct output and key/value
pairs using journalctl.
Change-Id: Id6f5161edfd09b672aba8751a6d2c6518665188a
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/monitor/fan_error.cpp b/monitor/fan_error.cpp
index ed8340d..54c2d22 100644
--- a/monitor/fan_error.cpp
+++ b/monitor/fan_error.cpp
@@ -21,6 +21,7 @@
#include <systemd/sd-journal.h>
#include <nlohmann/json.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <xyz/openbmc_project/Logging/Create/server.hpp>
#include <filesystem>
@@ -163,10 +164,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(
- std::format("Could not save log contents in FFDC. Error msg: {}",
- e.what())
- .c_str());
+ lg2::error("Could not save log contents in FFDC. Error msg: {ERROR}",
+ "ERROR", e);
}
return nullptr;
}