def add_global_filters_for_all_loggers():
    """
    Add global filters to all the loggers.

    This way we ensure "spamy" messages like heartbeat_tick are excluded also when --debug flag /
    system.debug config option is not set, but log level is set to DEBUG.
    """
    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)

    return loggers

    Add global filters to all the loggers.

    This way we ensure "spamy" messages like heartbeat_tick are excluded also when --debug flag /
    system.debug config option is not set, but log level is set to DEBUG.
    
st2common/st2common/logging/misc.py