mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-07 17:10:02 +01:00
add more logging.debug for #67
This commit is contained in:
parent
b529e93763
commit
3e7cc1f365
|
|
@ -31,15 +31,20 @@ def checkID(typ, id, msg=""):
|
|||
"""
|
||||
timestamp = int(time.time()) # Get Timestamp
|
||||
|
||||
logging.debug("checkID: %s (%s)", id, msg)
|
||||
for i in range(len(globals.doubleList)):
|
||||
(xID, xTimestamp, xMsg) = globals.doubleList[i]
|
||||
# given ID found?
|
||||
# return False if the first entry in double_ignore_time is found, we will not check for younger ones...
|
||||
if id == xID and timestamp < xTimestamp + globals.config.getint("BOSWatch", "doubleFilter_ignore_time"):
|
||||
logging.debug("-- previous id %s is within doubleFilter_ignore_time (%ss)", xID, globals.config.getint("BOSWatch", "doubleFilter_ignore_time"))
|
||||
# if wanted, we have to check the msg additional
|
||||
if "POC" in typ and globals.config.getint("BOSWatch", "doubleFilter_check_msg"):
|
||||
logging.debug("-- compare msg:")
|
||||
logging.debug("---- current msg: (%s)", msg.strip())
|
||||
logging.debug("---- previous msg: (%s)", xMsg)
|
||||
# if msg is a substring of xMsg we found a double
|
||||
if msg in xMsg:
|
||||
if msg.strip() in xMsg:
|
||||
logging.info("%s double alarm (id+msg): %s within %s second(s)", typ, xID, timestamp-xTimestamp)
|
||||
return False
|
||||
else:
|
||||
|
|
@ -55,7 +60,7 @@ def newEntry(id, msg = ""):
|
|||
@return: nothing
|
||||
"""
|
||||
timestamp = int(time.time()) # Get Timestamp
|
||||
globals.doubleList.append((id, timestamp, msg))
|
||||
globals.doubleList.append((id, timestamp, msg.strip()))
|
||||
|
||||
logging.debug("Added %s to doubleList", id)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Global variables
|
|||
|
||||
# version info
|
||||
versionNr = "2.1-dev"
|
||||
buildDate = "2015/07/28"
|
||||
buildDate = "2015/07/29"
|
||||
|
||||
# Global variables
|
||||
config = 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue