Skip to content

get_log_level

faststream.cli.utils.logs.get_log_level #

get_log_level(level: Union[LogLevels, str, int]) -> int

Get the log level.

PARAMETER DESCRIPTION
level

The log level to get. Can be an integer, a LogLevels enum value, or a string.

TYPE: Union[LogLevels, str, int]

RETURNS DESCRIPTION
int

The log level as an integer.

Note

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

Source code in faststream/cli/utils/logs.py
def get_log_level(level: Union[LogLevels, str, int]) -> int:
    """Get the log level.

    Args:
        level: The log level to get. Can be an integer, a LogLevels enum value, or a string.

    Returns:
        The log level as an integer.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    if isinstance(level, int):
        return level

    if isinstance(level, LogLevels):
        return LOG_LEVELS[level.value]

    if isinstance(level, str):  # pragma: no branch
        return LOG_LEVELS[level.lower()]

Last update: 2023-11-13