Esempio n. 1
0
class CaptureLogHandler(logging.StreamHandler):
    """A logging handler that stores log records and the log text."""
    def __init__(self):
        """Creates a new log handler."""
        logging.StreamHandler.__init__(self)
        self.records = []
        self.stream = TextIO()

    def close(self):
        """Close this log handler and its underlying stream."""
        self.stream.close()
        logging.StreamHandler.close(self)

    def emit(self, record):
        """Keep the log records in a list in addition to the log text."""
        self.records.append(record)
        logging.StreamHandler.emit(self, record)
Esempio n. 2
0
class CaptureLogHandler(logging.StreamHandler):
    """A logging handler that stores log records and the log text."""

    def __init__(self):
        """Creates a new log handler."""
        logging.StreamHandler.__init__(self)
        self.records = []
        self.stream = TextIO()

    def close(self):
        """Close this log handler and its underlying stream."""
        self.stream.close()
        logging.StreamHandler.close(self)

    def emit(self, record):
        """Keep the log records in a list in addition to the log text."""
        self.records.append(record)
        logging.StreamHandler.emit(self, record)
Esempio n. 3
0
 def __init__(self):
     """Creates a new log handler."""
     logging.StreamHandler.__init__(self)
     self.records = []
     self.stream = TextIO()
Esempio n. 4
0
 def __init__(self):
     """Creates a new log handler."""
     logging.StreamHandler.__init__(self)
     self.records = []
     self.stream = TextIO()