Skip to content

set_log_level

faststream.cli.utils.logs.set_log_level #

set_log_level(level: int, app: FastStream) -> None

Sets the log level for an application.

PARAMETER DESCRIPTION
level

The log level to set.

TYPE: int

app

The application object.

TYPE: FastStream

RETURNS DESCRIPTION
None

None

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/cli/utils/logs.py
def set_log_level(level: int, app: FastStream) -> None:
    """Sets the log level for an application.

    Args:
        level (int): The log level to set.
        app (FastStream): The application object.

    Returns:
        None
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    if app.logger and isinstance(app.logger, logging.Logger):
        app.logger.setLevel(level)

    broker_logger: Optional[logging.Logger] = getattr(app.broker, "logger", None)
    if broker_logger is not None and isinstance(broker_logger, logging.Logger):
        broker_logger.setLevel(level)

Last update: 2023-11-13