Correct the level field used for comparison

Unlike the `makeLogRecord` function, the constructor transforms the level into other fields.
pull/2669/head
Omar Pakker 7 months ago
parent 92f8647433
commit 1be1332950

@ -62,7 +62,7 @@ class UnwantedWaitressMessageFilter(logging.Filter):
# no filtering in debug mode or if originating from us
return True
if record.level < logging.ERROR:
if record.levelno < logging.ERROR:
return False
unwantedMessages = [

@ -3,13 +3,13 @@ import logging
from bazarr.app.logger import UnwantedWaitressMessageFilter
def test_true_for_bazarr():
record = LogRecord("", logging.INFO, "", 0, "a message from BAZARR for logging", (), None)
record = logging.LogRecord("", logging.INFO, "", 0, "a message from BAZARR for logging", (), None)
assert UnwantedWaitressMessageFilter().filter(record)
def test_false_below_error():
record = LogRecord("", logging.INFO, "", 0, "", (), None)
record = logging.LogRecord("", logging.INFO, "", 0, "", (), None)
assert not UnwantedWaitressMessageFilter().filter(record)
def test_true_above_error():
record = LogRecord("", logging.CRITICAL, "", 0, "", (), None)
record = logging.LogRecord("", logging.CRITICAL, "", 0, "", (), None)
assert UnwantedWaitressMessageFilter().filter(record)

Loading…
Cancel
Save