How to use the fbs.__main__._WrappingStreamHandler function in fbs

To help you get started, we’ve selected a few fbs 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 mherrmann / fbs / fbs / __main__.py View on Github external
def _init_logging():
    # Redirect INFO or lower to stdout, WARNING or higher to stderr:
    stdout = _WrappingStreamHandler(sys.stdout)
    stdout.setLevel(logging.DEBUG)
    stdout.addFilter(lambda record: record.levelno <= logging.INFO)
    # Don't wrap stderr because it may contain stack traces:
    stderr = logging.StreamHandler(sys.stderr)
    stderr.setLevel(logging.WARNING)
    logging.basicConfig(
        level=logging.INFO, format='%(message)s', handlers=(stdout, stderr)
    )