1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-21 23:32:31 +00:00

Fixed logging filter issue.

This commit is contained in:
morpheus65535 2024-09-20 07:42:16 -04:00
parent cc7a8000e7
commit 90b44802dc
2 changed files with 4 additions and 11 deletions

View file

@ -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 = [

View file

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