def set_log_level(log_level: LogLevel | None):
    """Set the log level.

    Args:
        log_level: The log level to set.

    Raises:
        TypeError: If the log level is a string.
    """
    if log_level is None:
        return
    if not isinstance(log_level, LogLevel):
        msg = f"log_level must be a LogLevel enum value, got {log_level} of type {type(log_level)} instead."
        raise TypeError(msg)
    global _LOG_LEVEL
    if log_level != _LOG_LEVEL:
        # Set the loglevel persistenly for subprocesses.
        os.environ["REFLEX_LOGLEVEL"] = log_level.value
    _LOG_LEVEL = log_level
Set the log level.

    Args:
        log_level: The log level to set.

    Raises:
        TypeError: If the log level is a string.
    
reflex/utils/console.py