Fixed logging filter bug introduced in 1.4.4

This commit is contained in:
Omar Pakker 2024-09-16 18:10:50 +02:00 committed by GitHub
parent 695887b584
commit cc7a8000e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View file

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

View file

@ -0,0 +1,22 @@
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"
})
assert UnwantedWaitressMessageFilter().filter(record)
def test_false_below_error():
record = logging.makeLogRecord({
"level": logging.INFO
})
assert not UnwantedWaitressMessageFilter().filter(record)
def test_true_error_up():
record = logging.makeLogRecord({
"level": logging.CRITICAL
})
assert UnwantedWaitressMessageFilter().filter(record)