Skip to content

set_logger_fmt

faststream.log.logging.set_logger_fmt #

set_logger_fmt(logger, fmt='%(asctime)s %(levelname)s - %(message)s')
Source code in faststream/log/logging.py
def set_logger_fmt(
    logger: logging.Logger,
    fmt: str = "%(asctime)s %(levelname)s - %(message)s",
) -> None:
    handler = logging.StreamHandler(stream=sys.stdout)

    formatter = ColourizedFormatter(
        fmt=fmt,
        use_colors=True,
    )
    handler.setFormatter(formatter)

    logger.addHandler(handler)