code: def __init__(self, logger, level):
      super(CapturingLogHandler, self).__init__(level=level)
      self.records = []
      if isinstance(logger, str):
          self.logger = logging.getLogger(logger)
      else:
          self.logger = logger
  
imports: import sys
  import logging
  import timeit
  from functools import wraps
  from collections.abc import Mapping, Callable
  import warnings
  from logging import PercentStyle
label_desc: Use image node_id 1 to create a new CapturingLogHandler object from inherited base classes: logging with example: obj = CapturingLogHandler(logger, level)