import sys
import logging

logger_level_relations = {
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'crit': logging.CRITICAL
}

def get_logger(name : str, level : str = 'info'):
    
    logger = logging.getLogger(name)
    logger.setLevel(logger_level_relations.get(level))
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logger_level_relations.get(level))
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    return logger