I have a logging handler that logs warning messages to a list. But the way my scripts are constructed, the logged line number of the messages will be offseted. So I wanted to modify the capture messages with my own line number. For example, I want -20 on the line number for my logged messages.
test.py:40: DeprecationWarning: xxxxxx. test.py:20: DeprecationWarning: xxxxxx. This is what I have so far:
class MyHandle(logging.Handler): def __init__(self, message_list): logging.Handler.__init__(self) self.message_list= message_list def emit(self, record): self.message_list.append(record.getMessage())