mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-21 06:03:50 +00:00
edit some files
This commit is contained in:
parent
2d279f6e71
commit
1ba76cc66b
4 changed files with 15 additions and 16 deletions
|
|
@ -65,7 +65,6 @@ class DescriptionList:
|
||||||
"""!Loads the given CSV file into internal list"""
|
"""!Loads the given CSV file into internal list"""
|
||||||
logging.debug("create new descriptionList")
|
logging.debug("create new descriptionList")
|
||||||
self._descriptionList = {}
|
self._descriptionList = {}
|
||||||
# self.loadCSV(csvType)
|
|
||||||
|
|
||||||
def getShortDescription(self, id):
|
def getShortDescription(self, id):
|
||||||
"""!Returns the short description of given id
|
"""!Returns the short description of given id
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,12 @@ class Packet:
|
||||||
- frequency"""
|
- frequency"""
|
||||||
config = Config()
|
config = Config()
|
||||||
logging.debug("add client data to bwPacket")
|
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("clientVersion", version.client)
|
||||||
self.setField("clientBuildDate", version.date)
|
self.setField("clientBuildDate", version.date)
|
||||||
self.setField("clientBranch", version.branch)
|
self.setField("clientBranch", version.branch)
|
||||||
self.setField("inputSource", config.getConfig("Server", "InputSource", "clientConfig"))
|
self.setField("inputSource", config.get("Server", "InputSource", "clientConfig"))
|
||||||
self.setField("frequency", config.getConfig("Stick", "Frequency", "clientConfig"))
|
self.setField("frequency", config.get("Stick", "Frequency", "clientConfig"))
|
||||||
|
|
||||||
def addServerData(self):
|
def addServerData(self):
|
||||||
"""!Add the server information to the decoded data
|
"""!Add the server information to the decoded data
|
||||||
|
|
@ -88,7 +88,7 @@ class Packet:
|
||||||
- serverBranch"""
|
- serverBranch"""
|
||||||
config = Config()
|
config = Config()
|
||||||
logging.debug("add server data to bwPacket")
|
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("serverVersion", version.server)
|
||||||
self.setField("serverBuildDate", version.date)
|
self.setField("serverBuildDate", version.date)
|
||||||
self.setField("serverBranch", version.branch)
|
self.setField("serverBranch", version.branch)
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
# from boswatch.module import file
|
|
||||||
|
|
||||||
logging.debug("- %s loaded", __name__)
|
logging.debug("- %s loaded", __name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -54,41 +52,42 @@ class Plugin:
|
||||||
self._pluginsActive -= 1
|
self._pluginsActive -= 1
|
||||||
self.onUnload()
|
self.onUnload()
|
||||||
|
|
||||||
logging.debug("%s statistics:", self._pluginName)
|
logging.debug("[%s] statistics:", self._pluginName)
|
||||||
logging.debug("- runs %d", self._runCount)
|
logging.debug("- runs %d", self._runCount)
|
||||||
logging.debug("- setup errors %d", self._setupErrorCount)
|
logging.debug("- setup errors %d", self._setupErrorCount)
|
||||||
logging.debug("- alarm errors %d", self._alarmErrorCount)
|
logging.debug("- alarm errors %d", self._alarmErrorCount)
|
||||||
logging.debug("- teardown errors %d", self._teardownErrorCount)
|
logging.debug("- teardown errors %d", self._teardownErrorCount)
|
||||||
|
|
||||||
def run(self, bwPacket):
|
def _run(self, bwPacket):
|
||||||
self._runCount += 1
|
self._runCount += 1
|
||||||
|
logging.debug("[%s] run #%s", self._pluginName, self._runCount)
|
||||||
|
|
||||||
self._setupTime = time.time()
|
self._setupTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("setup %s", self._pluginName)
|
logging.debug("[%s] setup", self._pluginName)
|
||||||
self.setup()
|
self.setup()
|
||||||
except:
|
except:
|
||||||
self._setupErrorCount += 1
|
self._setupErrorCount += 1
|
||||||
logging.exception("error in setup %s", self._pluginName)
|
logging.exception("[%s] error in setup", self._pluginName)
|
||||||
|
|
||||||
self._alarmTime = time.time()
|
self._alarmTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("alarm %s", self._pluginName)
|
logging.debug("[%s] alarm", self._pluginName)
|
||||||
self.alarm(bwPacket)
|
self.alarm(bwPacket)
|
||||||
except:
|
except:
|
||||||
self._alarmErrorCount += 1
|
self._alarmErrorCount += 1
|
||||||
logging.exception("error in alarm %s", self._pluginName)
|
logging.exception("[%s] error in alarm", self._pluginName)
|
||||||
|
|
||||||
self._teardownTime = time.time()
|
self._teardownTime = time.time()
|
||||||
try:
|
try:
|
||||||
logging.debug("teardown %s", self._pluginName)
|
logging.debug("[%s] teardown", self._pluginName)
|
||||||
self.teardown()
|
self.teardown()
|
||||||
except:
|
except:
|
||||||
self._teardownErrorCount += 1
|
self._teardownErrorCount += 1
|
||||||
logging.exception("error in teardown %s", self._pluginName)
|
logging.exception("[%s] error in teardown", self._pluginName)
|
||||||
|
|
||||||
self._endTime = time.time()
|
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("- setup: %0.2f sec.", self._alarmTime - self._setupTime)
|
||||||
logging.debug("- alarm: %0.2f sec.", self._teardownTime - self._alarmTime)
|
logging.debug("- alarm: %0.2f sec.", self._teardownTime - self._alarmTime)
|
||||||
logging.debug("- teardown: %0.2f sec.", self._endTime - self._teardownTime)
|
logging.debug("- teardown: %0.2f sec.", self._endTime - self._teardownTime)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ logging.debug("- %s loaded", __name__)
|
||||||
ROOT_PATH = os.path.dirname(sys.modules['boswatch'].__file__).replace("\\boswatch", "").replace("\\", "/")
|
ROOT_PATH = os.path.dirname(sys.modules['boswatch'].__file__).replace("\\boswatch", "").replace("\\", "/")
|
||||||
LOG_PATH = ROOT_PATH + "/log/"
|
LOG_PATH = ROOT_PATH + "/log/"
|
||||||
CONFIG_PATH = ROOT_PATH + "/config/"
|
CONFIG_PATH = ROOT_PATH + "/config/"
|
||||||
|
PLUGIN_PATH = ROOT_PATH + "/plugins/"
|
||||||
CSV_PATH = ROOT_PATH + "/csv/"
|
CSV_PATH = ROOT_PATH + "/csv/"
|
||||||
BIN_PATH = ROOT_PATH + "/_bin/"
|
BIN_PATH = ROOT_PATH + "/_bin/"
|
||||||
TEST_PATH = ROOT_PATH + "/test/"
|
TEST_PATH = ROOT_PATH + "/test/"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue