From ed095ed36650316d402fcc5c5ee48b76289dbb46 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 10 Jan 2018 21:56:02 +0100 Subject: [PATCH] change some logging in plugin main class --- boswatch/plugin/plugin.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boswatch/plugin/plugin.py b/boswatch/plugin/plugin.py index ed6a03d..dd95edc 100644 --- a/boswatch/plugin/plugin.py +++ b/boswatch/plugin/plugin.py @@ -28,7 +28,6 @@ class Plugin: def __init__(self, pluginName): """!init preload some needed locals and then call onLoad() directly""" self._pluginName = pluginName - logging.debug("load %s", self._pluginName) self._pluginsActive += 1 # for time counting @@ -44,11 +43,12 @@ class Plugin: self._alarmErrorCount = 0 self._teardownErrorCount = 0 + logging.debug("[%s] onLoad()", pluginName) self.onLoad() def __del__(self): """!Destructor calls onUnload() directly""" - logging.debug("unload %s", self._pluginName) + logging.debug("[%s] onUnload()", self._pluginName) self._pluginsActive -= 1 self.onUnload() @@ -63,33 +63,33 @@ class Plugin: def _run(self, bwPacket): self._runCount += 1 - logging.debug("[%s] run #%s", self._pluginName, self._runCount) + logging.debug("[%s] run #%d", self._pluginName, self._runCount) self._tmpTime = time.time() try: - logging.debug("[%s] setup", self._pluginName) + logging.debug("[%s] setup()", self._pluginName) self.setup() except: self._setupErrorCount += 1 - logging.exception("[%s] error in setup", self._pluginName) + logging.exception("[%s] error in setup()", self._pluginName) self._setupTime = time.time() - self._tmpTime self._tmpTime = time.time() try: - logging.debug("[%s] alarm", self._pluginName) + logging.debug("[%s] alarm()", self._pluginName) self.alarm(bwPacket) except: self._alarmErrorCount += 1 - logging.exception("[%s] error in alarm", self._pluginName) + logging.exception("[%s] error in alarm()", self._pluginName) self._alarmTime = time.time() - self._tmpTime self._tmpTime = time.time() try: - logging.debug("[%s] teardown", self._pluginName) + logging.debug("[%s] teardown()", self._pluginName) self.teardown() except: self._teardownErrorCount += 1 - logging.exception("[%s] error in teardown", self._pluginName) + logging.exception("[%s] error in teardown()", self._pluginName) self._teardownTime = time.time() - self._tmpTime self._sumTime = self._setupTime + self._alarmTime + self._teardownTime