
import logging


def set_logger(filename=None, level=None):
    level = {
        'CRITICAL' : logging.CRITICAL,
        'ERROR' : logging.ERROR,
        'WARNING' : logging.WARNING,
        'INFO' : logging.INFO,
        'DEBUG' : logging.DEBUG
    }[level.upper()]

    logger = logging.getLogger()
    logger.setLevel(level)
