From 0e952d6057b7c146ccfbb14863c6113bcbf581ae Mon Sep 17 00:00:00 2001 From: Schrolli Date: Tue, 26 May 2015 11:41:05 +0200 Subject: [PATCH] little debug and error edits --- includes/alarmHandler.py | 29 ++++++++++++++++------------- includes/decoder.py | 2 +- includes/filter.py | 2 +- includes/pluginLoader.py | 4 ++-- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/includes/alarmHandler.py b/includes/alarmHandler.py index 870133a..51536a7 100644 --- a/includes/alarmHandler.py +++ b/includes/alarmHandler.py @@ -6,20 +6,23 @@ import logging from includes import globals # Global variables def processAlarm(typ,freq,data): - logging.debug("[ ALARM ]") - for pluginName, plugin in globals.pluginList.items(): - - #if enabled use RegEx-Filter - if globals.config.getint("BOSWatch","useRegExFilter"): - from includes import filter - if filter.checkFilters(data,typ,pluginName): + try: + logging.debug("[ ALARM ]") + for pluginName, plugin in globals.pluginList.items(): + + #if enabled use RegEx-Filter + if globals.config.getint("BOSWatch","useRegExFilter"): + from includes import filter + if filter.checkFilters(data,typ,pluginName): + logging.debug("call Plugin: %s", pluginName) + plugin.run(typ,freq,data) + logging.debug("return from: %s", pluginName) + + else: logging.debug("call Plugin: %s", pluginName) plugin.run(typ,freq,data) logging.debug("return from: %s", pluginName) - else: - logging.debug("call Plugin: %s", pluginName) - plugin.run(typ,freq,data) - logging.debug("return from: %s", pluginName) - - logging.debug("[END ALARM]") \ No newline at end of file + logging.debug("[END ALARM]") + except: + logging.exception("Error in Alarm processing") \ No newline at end of file diff --git a/includes/decoder.py b/includes/decoder.py index f05fd0b..680f803 100644 --- a/includes/decoder.py +++ b/includes/decoder.py @@ -27,4 +27,4 @@ def decode(freq, decoded): poc.decode(freq, decoded) except: - logging.exception("cannot start decoder") + logging.exception("cannot start decoder") \ No newline at end of file diff --git a/includes/filter.py b/includes/filter.py index 72a2aac..7de49c4 100644 --- a/includes/filter.py +++ b/includes/filter.py @@ -9,8 +9,8 @@ from includes import globals # Global variables def loadFilters(): - logging.debug("loading filters") try: + logging.debug("loading filters") for key,val in globals.config.items("Filters"): logging.debug(" - %s = %s", key, val) filter = val.split(";") diff --git a/includes/pluginLoader.py b/includes/pluginLoader.py index ae591cf..2818143 100644 --- a/includes/pluginLoader.py +++ b/includes/pluginLoader.py @@ -24,7 +24,7 @@ def getPlugins(): plugins = [] for i in os.listdir(PluginFolder): location = os.path.join(PluginFolder, i) - # plugins have to be a subdir with MainModule, if not skip + if not os.path.isdir(location) or not i + ".py" in os.listdir(location): continue @@ -36,7 +36,7 @@ def getPlugins(): logging.debug("Plugin [ENABLED ] %s", i) else: logging.debug("Plugin [DISABLED] %s ", i) - except: #no entry for plugin found in config-file, skip + except: #no entry for plugin found in config-file logging.warning("Plugin [NO CONF ] %s", i) except: logging.exception("Error during Plugin search")