def tester(record): isBenign = record.levelno not in concerningLogLevels # TODO is this sufficient to test if a log is from test or not? isTest = os.path.sep + 'test' in record.pathname if wlfunc: wl = whitelist() else: wl = whitelist whiteListedExceptions = baseWhitelist + wl # Converting the log message to its string representation, the log # message can be an arbitrary object if not (isBenign or isTest): msg = str(record.msg) # TODO combine whitelisted with '|' and use one regex for msg isWhiteListed = any( re.search(w, msg) for w in whiteListedExceptions) if not isWhiteListed: # Stopping all loopers, so prodables like nodes, clients, etc stop. # This helps in freeing ports for fv in request._fixture_values.values(): if isinstance(fv, Looper): fv.stopall() if isinstance(fv, Prodable): fv.stop() raise BlowUp("{}: {} ".format(record.levelname, record.msg))
def tester(record): isBenign = record.levelno not in concerningLogLevels # TODO is this sufficient to test if a log is from test or not? isTest = os.path.sep + 'test' in record.pathname if wlfunc: wl = whitelist() else: wl = whitelist whiteListedExceptions = baseWhitelist + wl isWhiteListed = bool( [w for w in whiteListedExceptions if w in record.msg]) if not (isBenign or isTest or isWhiteListed): raise BlowUp("{}: {} ".format(record.levelname, record.msg))
def tester(record): isBenign = record.levelno not in concerningLogLevels # TODO is this sufficient to test if a log is from test or not? isTest = os.path.sep + 'test' in record.pathname if wlfunc: wl = whitelist() else: wl = whitelist whiteListedExceptions = baseWhitelist + wl # Converting the log message to its string representation, the log # message can be an arbitrary object msg = str(record.msg) isWhiteListed = bool( [w for w in whiteListedExceptions if re.search(w, msg)]) if not (isBenign or isTest or isWhiteListed): raise BlowUp("{}: {} ".format(record.levelname, record.msg))