edit some files

This commit is contained in:
Bastian Schroll 2018-01-08 23:42:26 +01:00
parent 2d279f6e71
commit 1ba76cc66b
4 changed files with 15 additions and 16 deletions

View file

@ -65,7 +65,6 @@ class DescriptionList:
"""!Loads the given CSV file into internal list"""
logging.debug("create new descriptionList")
self._descriptionList = {}
# self.loadCSV(csvType)
def getShortDescription(self, id):
"""!Returns the short description of given id

View file

@ -71,12 +71,12 @@ class Packet:
- frequency"""
config = Config()
logging.debug("add client data to bwPacket")
self.setField("clientName", config.getConfig("Client", "Name", "clientConfig"))
self.setField("clientName", config.get("Client", "Name", "clientConfig"))
self.setField("clientVersion", version.client)
self.setField("clientBuildDate", version.date)
self.setField("clientBranch", version.branch)
self.setField("inputSource", config.getConfig("Server", "InputSource", "clientConfig"))
self.setField("frequency", config.getConfig("Stick", "Frequency", "clientConfig"))
self.setField("inputSource", config.get("Server", "InputSource", "clientConfig"))
self.setField("frequency", config.get("Stick", "Frequency", "clientConfig"))
def addServerData(self):
"""!Add the server information to the decoded data
@ -88,7 +88,7 @@ class Packet:
- serverBranch"""
config = Config()
logging.debug("add server data to bwPacket")
self.setField("serverName", config.getConfig("Server", "Name", "serverConfig"))
self.setField("serverName", config.get("Server", "Name", "serverConfig"))
self.setField("serverVersion", version.server)
self.setField("serverBuildDate", version.date)
self.setField("serverBranch", version.branch)

View file

@ -17,8 +17,6 @@
import logging
import time
# from boswatch.module import file
logging.debug("- %s loaded", __name__)
@ -54,41 +52,42 @@ class Plugin:
self._pluginsActive -= 1
self.onUnload()
logging.debug("%s statistics:", self._pluginName)
logging.debug("[%s] statistics:", self._pluginName)
logging.debug("- runs %d", self._runCount)
logging.debug("- setup errors %d", self._setupErrorCount)
logging.debug("- alarm errors %d", self._alarmErrorCount)
logging.debug("- teardown errors %d", self._teardownErrorCount)
def run(self, bwPacket):
def _run(self, bwPacket):
self._runCount += 1
logging.debug("[%s] run #%s", self._pluginName, self._runCount)
self._setupTime = time.time()
try:
logging.debug("setup %s", self._pluginName)
logging.debug("[%s] setup", self._pluginName)
self.setup()
except:
self._setupErrorCount += 1
logging.exception("error in setup %s", self._pluginName)
logging.exception("[%s] error in setup", self._pluginName)
self._alarmTime = time.time()
try:
logging.debug("alarm %s", self._pluginName)
logging.debug("[%s] alarm", self._pluginName)
self.alarm(bwPacket)
except:
self._alarmErrorCount += 1
logging.exception("error in alarm %s", self._pluginName)
logging.exception("[%s] error in alarm", self._pluginName)
self._teardownTime = time.time()
try:
logging.debug("teardown %s", self._pluginName)
logging.debug("[%s] teardown", self._pluginName)
self.teardown()
except:
self._teardownErrorCount += 1
logging.exception("error in teardown %s", self._pluginName)
logging.exception("[%s] error in teardown", self._pluginName)
self._endTime = time.time()
logging.debug("%s took %0.2f seconds", self._pluginName, self._endTime - self._setupTime)
logging.debug("[%s] took %0.2f seconds", self._pluginName, self._endTime - self._setupTime)
logging.debug("- setup: %0.2f sec.", self._alarmTime - self._setupTime)
logging.debug("- alarm: %0.2f sec.", self._teardownTime - self._alarmTime)
logging.debug("- teardown: %0.2f sec.", self._endTime - self._teardownTime)

View file

@ -23,6 +23,7 @@ logging.debug("- %s loaded", __name__)
ROOT_PATH = os.path.dirname(sys.modules['boswatch'].__file__).replace("\\boswatch", "").replace("\\", "/")
LOG_PATH = ROOT_PATH + "/log/"
CONFIG_PATH = ROOT_PATH + "/config/"
PLUGIN_PATH = ROOT_PATH + "/plugins/"
CSV_PATH = ROOT_PATH + "/csv/"
BIN_PATH = ROOT_PATH + "/_bin/"
TEST_PATH = ROOT_PATH + "/test/"