Created
June 10, 2023 03:46
-
-
Save chapmanjacobd/85f331ec48f130c9bf772d70045a42d4 to your computer and use it in GitHub Desktop.
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
| class DictHandler(logging.Handler): | |
| def __init__(self, log_dict): | |
| super().__init__() | |
| self.log_dict = log_dict | |
| def emit(self, record): | |
| log_entry = self.format(record) | |
| self.log_dict.setdefault(record.levelname, []).append(log_entry) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment