improve enum logging
Ensure we're using an enumeration string everywhere we log one to
improve readability of the log statements.
This depends on I6850b0bb142f0ef5219a5fc07c2cb4e2c90d5779 from
phosphor-logging for `to_string` conversion support.
Tested:
Running directly on development system shows:
```
<7> TYPE=CPU, NAME=CPU SUBTYPE=CPU PATH=, FREQ=1, WSIZE=120
<7> THRESHOLD TYPE=xyz.openbmc_project.Common.Threshold.Type.Warning THRESHOLD BOUND=xyz.openbmc_project.Common.Threshold.Bound.Upper VALUE=80.000000 LOG=False TARGET=
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I5ea7a050e94833af272e79e6add716d1d3e66571
diff --git a/health_metric.cpp b/health_metric.cpp
index 4c391cd..8ee427b 100644
--- a/health_metric.cpp
+++ b/health_metric.cpp
@@ -60,8 +60,7 @@
}
default:
{
- error("Invalid Memory metric {TYPE}", "TYPE",
- std::to_underlying(subType));
+ error("Invalid Memory metric {TYPE}", "TYPE", subType);
return "";
}
}
@@ -130,8 +129,7 @@
}
default:
{
- error("Invalid threshold bound {BOUND}", "BOUND",
- std::to_underlying(bound));
+ error("Invalid threshold bound {BOUND}", "BOUND", bound);
return false;
}
}
@@ -162,8 +160,7 @@
{
error(
"ASSERT: Health Metric {METRIC} crossed {TYPE} upper threshold",
- "METRIC", config.name, "TYPE",
- sdbusplus::message::convert_to_string(type));
+ "METRIC", config.name, "TYPE", type);
startUnit(bus, tConfig.target);
}
}
@@ -178,8 +175,7 @@
{
info(
"DEASSERT: Health Metric {METRIC} is below {TYPE} upper threshold",
- "METRIC", config.name, "TYPE",
- sdbusplus::message::convert_to_string(type));
+ "METRIC", config.name, "TYPE", type);
}
}
}