'Captures the current logging context'

def __enter__(self):

    self.current_context = LoggingContext.set_current_context(self.new_context)
    if self.current_context:
        self.has_parent = (self.current_context.previous_context is not None)
        if (not self.current_context.alive):
            logger.debug('Entering    dead    context:    %s', self.current_context)
