Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log filter level check. #2663

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bazarr/app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def filter(self, record):
# no filtering in debug mode or if originating from us
return True

if record.level != loggin.ERROR:
if record.level < logging.ERROR:
return False

unwantedMessages = [
Expand Down
22 changes: 22 additions & 0 deletions tests/test_logging_filters.py
Original file line number Diff line number Diff line change
@@ -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)