Skip to content

Commit

Permalink
Make logging levels case insensitive
Browse files Browse the repository at this point in the history
Added '.lower()' to string being parsed for logging.
  • Loading branch information
JessicaBell00 committed Aug 20, 2024
1 parent 5f6be69 commit 666fb02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ def check_for_logging(self, node):
matches = [".warning", ".error"]
for j in node:
if isinstance(j, astroid.Expr):
expression = j.as_string()
expression = j.as_string().lower()
if any(x in expression for x in matches):
self.add_message(
msgid=f"do-not-log-raised-errors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4844,7 +4844,7 @@ def test_error_level_not_logged(self):
try: #@
add = 1 + 2
except Exception as e:
logger.error(str(e)) #@
logger.ERROR(str(e)) #@
raise
'''
)
Expand Down

0 comments on commit 666fb02

Please sign in to comment.