control: Add power on/offs to flight recorder
Add entries for when the power state changes to the flight recorder.
This can help provide context to other entries that may occur due to the
power on/off, as well as give a history of the state changes without
needing to search journal output, if there is any.
Tested:
```
"Nov 08 18:04:53.922812: pcie_card_floors-58: Found 0 hot cards, 1 with temp sensors, 0 uninteresting",
"Nov 08 18:05:12.104198: power: Power off",
"Nov 08 18:05:24.830231: pcie_card_floors-58: Found 0 hot cards, 0 with temp sensors, 0 uninteresting",
"Nov 08 18:08:24.172855: power: Power On",
```
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I7605401c1dac5162903e13ae8ad71de2928ddd13
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 838bd30..efce6f0 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -230,6 +230,7 @@
{
if (powerStateOn)
{
+ FlightRecorder::instance().log("power", "Power on");
if (_zones.empty())
{
throw std::runtime_error("No configured zones found at poweron");
@@ -244,6 +245,7 @@
}
else
{
+ FlightRecorder::instance().log("power", "Power off");
// Tell events to run their power off triggers
std::for_each(_events.begin(), _events.end(),
[](const auto& entry) { entry.second->powerOff(); });