'Modify the logging module\'s registered handlers and push a new context
onto the stack.
:param add_handlers_fn: function to modify the registered logging
handlers. Accepts a context dictionary which may be modified.'

def _add_log_handlers(self, add_handlers_fn):

    self._flush_all_streams()
    context = self._get_context()
    add_handlers_fn(context)
    self._push_context(context)
