Move debug condition handling to Logger

Avoids many dozens of conditionals sprinkled throughout the code by
centralizing this check into the main Logger instance.
This commit is contained in:
2023-12-27 12:58:36 -05:00
parent 52bf5ad0ef
commit e654fbba08
4 changed files with 205 additions and 267 deletions

View File

@ -157,9 +157,6 @@ class MonitoringPlugin(object):
"w": warning
"e": error
"""
if state == "d" and not self.config["debug"]:
return
self.logger.out(message, state=state, prefix=self.plugin_name)
#
@ -523,11 +520,10 @@ class MonitoringInstance(object):
entries = fault_data["entries"]()
if self.config["debug"]:
self.logger.out(
f"Entries for fault check {fault_type}: {dumps(entries)}",
state="d",
)
self.logger.out(
f"Entries for fault check {fault_type}: {dumps(entries)}",
state="d",
)
for _entry in entries:
entry = _entry["entry"]