Skip to content

Commit

Permalink
Catch more comptypes spam in logging filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Crozzers committed Nov 24, 2023
1 parent 6fb326d commit cb7a52c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
class LoggingFilter(logging.Filter):
def filter(self, record):
try:
return 'Release <POINTER(IApplicationView)' not in record.message
return not (
# sometimes the record has msg, sometimes its message. Just try to catch all of them
'Release ' in getattr(record, 'message', getattr(record, 'msg', ''))
and record.name == 'comtypes'
)
except Exception:
# sometimes (rarely) record doesn't have a `message` attr
return True
Expand Down

0 comments on commit cb7a52c

Please sign in to comment.