Add failsafe logger for zones
Tested:
...
Nov 23 21:40:06 tmddp10-nfd01.prod.google.com swampd[4893]:
Zone `0` is in failsafe mode.
With update at `fleeting0`: The sensor has bad readings.
Nov 23 21:40:06 tmddp10-nfd01.prod.google.com swampd[4893]:
Zone `1` is in failsafe mode.
With update at `fleeting1`: The sensor has bad readings.
Nov 23 21:40:06 tmddp10-nfd01.prod.google.com swampd[4893]:
Zone `1` leaves failsafe mode.
With update at `hotswap_in_Input_Power`: The sensor has recovered.
Nov 23 21:40:06 tmddp10-nfd01.prod.google.com swampd[4893]:
Zone `0` leaves failsafe mode.
With update at `hotswap_in_Input_Power`: The sensor has recovered.
...
Change-Id: I2c296addb7ad117c03c04a27de91204796cda036
Signed-off-by: James Zheng <alphetis@google.com>
diff --git a/sensors/host.cpp b/sensors/host.cpp
index 51d38a4..39eeb5f 100644
--- a/sensors/host.cpp
+++ b/sensors/host.cpp
@@ -16,6 +16,8 @@
#include "host.hpp"
+#include "failsafeloggers/failsafe_logger_utility.hpp"
+
#include <cmath>
#include <iostream>
#include <memory>
@@ -102,6 +104,8 @@
return false;
}
+ outputFailsafeLogWithSensor(getName(), true, getName(),
+ "The sensor has invalid readings.");
return true;
}