Exemplo n.º 1
0
def set_loggers(config):
    from rqalpha.utils.logger import user_log, user_system_log, system_log
    from rqalpha.utils.logger import init_logger
    from rqalpha.utils import logger
    extra_config = config.extra

    init_logger()

    for log in [system_log, user_system_log]:
        log.level = getattr(logbook, config.extra.log_level.upper(),
                            logbook.NOTSET)

    user_log.level = logbook.DEBUG

    if extra_config.log_level.upper() != "NONE":
        if extra_config.user_log_disabled:
            user_log.disable()
        else:
            user_log.enable()

        if extra_config.user_system_log_disabled:
            user_system_log.disable()
        else:
            user_system_log.enable()

    for logger_name, level in extra_config.logger:
        getattr(logger, logger_name).level = getattr(logbook, level.upper())
Exemplo n.º 2
0
def run_with_user_log_disabled(disabled=True):
    from rqalpha.utils.logger import user_log

    if disabled:
        user_log.disable()
    try:
        yield
    finally:
        if disabled:
            user_log.enable()
Exemplo n.º 3
0
def run_with_user_log_disabled(disabled=True):
    from rqalpha.utils.logger import user_log

    if disabled:
        user_log.disable()
    try:
        yield
    finally:
        if disabled:
            user_log.enable()