How to use the daiquiri.handlers.TTYDetectorStreamHandler function in daiquiri

To help you get started, we’ve selected a few daiquiri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jd / daiquiri / daiquiri / output.py View on Github external
def __init__(self, stream=sys.stderr, formatter=formatter.TEXT_FORMATTER,
                 level=None):
        super(Stream, self).__init__(handlers.TTYDetectorStreamHandler(stream),
                                     formatter, level)
github jd / daiquiri / daiquiri / handlers.py View on Github external
def format(self, record):
        if hasattr(self.stream, "isatty"):
            try:
                record._stream_is_a_tty = self.stream.isatty()
            except ValueError:
                # Stream has been closed, usually during interpretor shutdown
                record._stream_is_a_tty = False
        else:
            record._stream_is_a_tty = False
        s = super(TTYDetectorStreamHandler, self).format(record)
        del record._stream_is_a_tty
        return s