Fix Elastic log filter

This commit is contained in:
allegroai 2021-01-05 17:12:57 +02:00
parent ca81922651
commit 5e0893dd80

View File

@ -50,14 +50,14 @@ class ConnectionErrorFilter(logging.Filter):
def filter(self, record): def filter(self, record):
try: try:
allow = ( filter_out = (
(self.err_type is None or record.exc_info[0] != self.err_type) (self.err_type is None or record.exc_info[0] == self.err_type)
and (self.level is None or record.levelno != self.level) and (self.level is None or record.levelno == self.level)
and (self.args is None or record.args[: len(self.args)] != self.args) and (self.args is None or record.args[: len(self.args)] == self.args)
) )
if not allow: if filter_out:
self.last_blocked = record self.last_blocked = record
return allow return not filter_out
except Exception: except Exception:
return True return True