Skip to content

Instantly share code, notes, and snippets.

@chapmanjacobd
Created June 10, 2023 03:46
Show Gist options
  • Select an option

  • Save chapmanjacobd/85f331ec48f130c9bf772d70045a42d4 to your computer and use it in GitHub Desktop.

Select an option

Save chapmanjacobd/85f331ec48f130c9bf772d70045a42d4 to your computer and use it in GitHub Desktop.
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