def config_logger(write_logs, log_level, log_file, verbose):
    """
    Initialize the logger for ToolDog. By default, only WARNING, ERROR and CRITICAL are
    written on STDERR. You can also write logs to a log file.

    :param write_logs: Decide to write logs to output log file.
    :type write_logs: BOOLEAN
    :param log_level: Select the level of logs. 'debug', 'info' or 'warn'. Other value    is considered as 'warn'.
    :type log_level: STRING
    :param log_file: path to output log file.
    :type log_file: STRING

    :return: Config dictionnary for logger.
    :rtype: DICT
    """
    cfg = {'version': 1, 'formatters': {'written': {'format': 
        '%(asctime)s :: %(name)s ' + ':: %(levelname)s :: %(message)s'},
        'printed': {'format': '%(name)s :: ' +
        '%(levelname)s :: %(message)s'}}, 'handlers': {}, 'loggers': {}}
    if write_logs:
        cfg_logfile = {'class': 'logging.handlers.RotatingFileHandler',
            'formatter': 'written', 'maxBytes': 1000000, 'backupCount': 1}
        cfg_logfile['level'] = log_level
        cfg_logfile['filename'] = log_file
        cfg['handlers']['logfile'] = cfg_logfile
    cfg_stderr = {'class': 'logging.StreamHandler', 'formatter': 'printed'}
    cfg_stderr['level'] = 'WARNING'
    if verbose:
        cfg_stderr['level'] = 'INFO'
    cfg['handlers']['stderr'] = cfg_stderr
    modules = ['annotate.galaxy', 'annotate.cwl', 'annotate.edam_to_galaxy',
        'analyse', 'analyse.tool_analazer', 'analyse.code_collector',
        'analyse.language_analyzer', 'biotool_model', 'main', 'analyse']
    logger = {'handlers': ['stderr'], 'propagate': False, 'level': 'DEBUG'}
    if write_logs:
        logger['handlers'].append('logfile')
    for module in modules:
        cfg['loggers']['tooldog.' + module] = logger
    return cfg
