control:utils: Log pcie card config file loading
Include the "loading" and "successfully loaded" messages to the journal
and flight recorder for all the `pcie_cards.json` config files that are
loaded into fan control.
Change-Id: Idcd5d307cd3d2fb8b462a57f0603aadc1c30c64e
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/utils/pcie_card_metadata.cpp b/control/json/utils/pcie_card_metadata.cpp
index e33f747..8e65c7c 100644
--- a/control/json/utils/pcie_card_metadata.cpp
+++ b/control/json/utils/pcie_card_metadata.cpp
@@ -17,6 +17,9 @@
#include "pcie_card_metadata.hpp"
#include "json_config.hpp"
+#include "utils/flight_recorder.hpp"
+
+#include <fmt/format.h>
#include <iostream>
@@ -47,11 +50,16 @@
if (fs::exists(confFile))
{
- log<level::DEBUG>(
- fmt::format("Loading PCIe card file {}", confFile.native())
- .c_str());
- auto json = JsonConfig::load(confFile);
- load(json);
+ FlightRecorder::instance().log(
+ "main",
+ fmt::format("Loading configuration from {}", confFile.string()));
+ load(JsonConfig::load(confFile));
+ FlightRecorder::instance().log(
+ "main", fmt::format("Configuration({}) loaded successfully",
+ confFile.string()));
+ log<level::INFO>(fmt::format("Configuration({}) loaded successfully",
+ confFile.string())
+ .c_str());
}
// Go from least specific to most specific in the system names so files in
@@ -71,12 +79,17 @@
if (fs::exists(confFile))
{
- log<level::DEBUG>(
- fmt::format("Loading PCIe card file {}", confFile.native())
+ FlightRecorder::instance().log(
+ "main", fmt::format("Loading configuration from {}",
+ confFile.string()));
+ load(JsonConfig::load(confFile));
+ FlightRecorder::instance().log(
+ "main", fmt::format("Configuration({}) loaded successfully",
+ confFile.string()));
+ log<level::INFO>(
+ fmt::format("Configuration({}) loaded successfully",
+ confFile.string())
.c_str());
-
- auto json = JsonConfig::load(confFile);
- load(json);
}
}