This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def monkeypatch_logging_getMessage(): | |
""" Monkey patch logging.LogRecord.getMessage so it will never, ever raise an exception. """ | |
from unstdlib import to_str | |
from logging import LogRecord | |
oldGetMessage = LogRecord.getMessage | |
def getMessage(self): | |
try: | |
return oldGetMessage(self) | |
except Exception as e: |
OlderNewer