mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-21 06:03:50 +00:00
change some logging in plugin main class
This commit is contained in:
parent
0383744927
commit
ed095ed366
1 changed files with 9 additions and 9 deletions
|
|
@ -28,7 +28,6 @@ class Plugin:
|
||||||
def __init__(self, pluginName):
|
def __init__(self, pluginName):
|
||||||
"""!init preload some needed locals and then call onLoad() directly"""
|
"""!init preload some needed locals and then call onLoad() directly"""
|
||||||
self._pluginName = pluginName
|
self._pluginName = pluginName
|
||||||
logging.debug("load %s", self._pluginName)
|
|
||||||
self._pluginsActive += 1
|
self._pluginsActive += 1
|
||||||
|
|
||||||
# for time counting
|
# for time counting
|
||||||
|
|
@ -44,11 +43,12 @@ class Plugin:
|
||||||
self._alarmErrorCount = 0
|
self._alarmErrorCount = 0
|
||||||
self._teardownErrorCount = 0
|
self._teardownErrorCount = 0
|
||||||
|
|
||||||
|
logging.debug("[%s] onLoad()", pluginName)
|
||||||
self.onLoad()
|
self.onLoad()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""!Destructor calls onUnload() directly"""
|
"""!Destructor calls onUnload() directly"""
|
||||||
logging.debug("unload %s", self._pluginName)
|
logging.debug("[%s] onUnload()", self._pluginName)
|
||||||
self._pluginsActive -= 1
|
self._pluginsActive -= 1
|
||||||
self.onUnload()
|
self.onUnload()
|
||||||
|
|
||||||
|
|
@ -63,33 +63,33 @@ class Plugin:
|
||||||
|
|
||||||
def _run(self, bwPacket):
|
def _run(self, bwPacket):
|
||||||
self._runCount += 1
|
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()
|
self._tmpTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("[%s] setup", self._pluginName)
|
logging.debug("[%s] setup()", self._pluginName)
|
||||||
self.setup()
|
self.setup()
|
||||||
except:
|
except:
|
||||||
self._setupErrorCount += 1
|
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._setupTime = time.time() - self._tmpTime
|
||||||
self._tmpTime = time.time()
|
self._tmpTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("[%s] alarm", self._pluginName)
|
logging.debug("[%s] alarm()", self._pluginName)
|
||||||
self.alarm(bwPacket)
|
self.alarm(bwPacket)
|
||||||
except:
|
except:
|
||||||
self._alarmErrorCount += 1
|
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._alarmTime = time.time() - self._tmpTime
|
||||||
self._tmpTime = time.time()
|
self._tmpTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("[%s] teardown", self._pluginName)
|
logging.debug("[%s] teardown()", self._pluginName)
|
||||||
self.teardown()
|
self.teardown()
|
||||||
except:
|
except:
|
||||||
self._teardownErrorCount += 1
|
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._teardownTime = time.time() - self._tmpTime
|
||||||
self._sumTime = self._setupTime + self._alarmTime + self._teardownTime
|
self._sumTime = self._setupTime + self._alarmTime + self._teardownTime
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue