def configure_logging(emit_list):
    """Configure logging to send log records to the master."""
    if 'sphinx' in sys.modules:
        module_base = 'resolwe.flow.executors'
    else:
        module_base = 'executors'
    logging_config = dict(
        version=1,
        formatters={
            'json_formatter': {
                '()': JSONFormatter
            },
        },
        handlers={
            'redis': {
                'class': module_base + '.logger.RedisHandler',
                'formatter': 'json_formatter',
                'level': logging.INFO,
                'emit_list': emit_list
            },
            'console': {
                'class': 'logging.StreamHandler',
                'level': logging.WARNING
            },

        },
        root={
            'handlers': ['redis', 'console'],
            'level': logging.DEBUG,
        },
        loggers={
            # Don't use redis logger to prevent circular dependency.
            module_base + '.manager_comm': {
                'level': 'INFO',
                'handlers': ['console'],
                'propagate': False,
            },
        },
    )

    dictConfig(logging_config)
Configure logging to send log records to the master.