def set_log_level_for_all_loggers(level=logging.DEBUG):
    """
    Set a log level for all the loggers and handlers to the provided level.
    """
    root_logger = logging.getLogger()
    loggers = list(logging.Logger.manager.loggerDict.values())
    loggers += [root_logger]

    for logger in loggers:
        if not isinstance(logger, logging.Logger):
            continue

        logger = add_filters_for_logger(logger=logger, filters=GLOBAL_FILTERS)

        if logger.name in SPECIAL_LOGGERS:
            set_log_level_for_all_handlers(
                logger=logger, level=SPECIAL_LOGGERS.get(logger.name)
            )
        else:
            set_log_level_for_all_handlers(logger=logger, level=level)

    return loggers

    Set a log level for all the loggers and handlers to the provided level.
    
st2common/st2common/logging/misc.py