control: Log target holds in flight recorder
Log when the holds are added and removed, and when it forces fan
changes.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id370f977e1b587bf23fc22b946ad8d9004dd1474
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index 6cda0a9..67970a8 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -146,12 +146,27 @@
void Zone::setTargetHold(const std::string& ident, uint64_t target, bool hold)
{
+ using namespace std::string_literals;
+
if (!hold)
{
- _targetHolds.erase(ident);
+ size_t removed = _targetHolds.erase(ident);
+ if (removed)
+ {
+ FlightRecorder::instance().log(
+ "zone-target"s + getName(),
+ fmt::format("{} is removing target hold", ident));
+ }
}
else
{
+ if (!((_targetHolds.find(ident) != _targetHolds.end()) &&
+ (_targetHolds[ident] == target)))
+ {
+ FlightRecorder::instance().log(
+ "zone-target"s + getName(),
+ fmt::format("{} is setting target hold to {}", ident, target));
+ }
_targetHolds[ident] = target;
_isActive = false;
}
@@ -166,6 +181,14 @@
}
else
{
+ if (_target != itHoldMax->second)
+ {
+ FlightRecorder::instance().log(
+ "zone-target"s + getName(),
+ fmt::format("Settings fans to target hold of {}",
+ itHoldMax->second));
+ }
+
_target = itHoldMax->second;
for (auto& fan : _fans)
{