def get_logger(name="peyotl"):
    """Returns a logger with name set as given. See _read_logging_config for a description of the env var/config
    file cascade that controls configuration of the logger.
    """
    logger = logging.getLogger(name)
    if len(logger.handlers) == 0:
        log_init_warnings = []
        lc = _read_logging_config(log_init_warnings)
        logger.setLevel(lc['level'])
        if lc['filepath'] is not None:
            log_dir = lc['log_dir']
            if log_dir and not os.path.exists(log_dir):
                os.makedirs(log_dir)
            ch = logging.FileHandler(lc['filepath'])
        else:
            ch = logging.StreamHandler()
        ch.setLevel(lc['level'])
        ch.setFormatter(lc['formatter'])
        logger.addHandler(ch)
        if log_init_warnings:
            for w in log_init_warnings:
                logger.warn(w)
    return logger