regulators: Modify monitorSensors() to use Services
Modify the monitorSensors() method in the System, Chassis, Device, and
Rail classes to have a new first parameter: Services& services.
Modify SensorMonitoring::execute() to log messages using the new
Journal interface.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I05820cfa94bc3d15dee7a1714a3d253720aa7f92
diff --git a/phosphor-regulators/src/sensor_monitoring.cpp b/phosphor-regulators/src/sensor_monitoring.cpp
index 6135b50..07ae635 100644
--- a/phosphor-regulators/src/sensor_monitoring.cpp
+++ b/phosphor-regulators/src/sensor_monitoring.cpp
@@ -21,7 +21,6 @@
#include "chassis.hpp"
#include "device.hpp"
#include "exception_utils.hpp"
-#include "journal.hpp"
#include "rail.hpp"
#include "system.hpp"
@@ -30,8 +29,8 @@
namespace phosphor::power::regulators
{
-void SensorMonitoring::execute(System& system, Chassis& /*chassis*/,
- Device& device, Rail& rail)
+void SensorMonitoring::execute(Services& services, System& system,
+ Chassis& /*chassis*/, Device& device, Rail& rail)
{
try
{
@@ -44,8 +43,9 @@
catch (const std::exception& e)
{
// Log error messages in journal
- exception_utils::log(e);
- journal::logErr("Unable to monitor sensors for rail " + rail.getID());
+ services.getJournal().logError(exception_utils::getMessages(e));
+ services.getJournal().logError("Unable to monitor sensors for rail " +
+ rail.getID());
// TODO: Create error log entry
}