mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-12-27 01:28:16 +08:00
Fixed logging filter bug introduced in 1.4.4
This commit is contained in:
parent
695887b584
commit
cc7a8000e7
2 changed files with 23 additions and 1 deletions
|
@ -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 = [
|
||||||
|
|
22
tests/test_logging_filters.py
Normal file
22
tests/test_logging_filters.py
Normal 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)
|
Loading…
Reference in a new issue