import logging


def get_logger(name=None, default_level=logging.INFO):
    """
    Create a Logger object to use instead of relying on print statements.

    :param name: str name of logger. If None, then root logger is used.
    :param default_level: Log Level
    :return logger: A Configured logger object
    """
    logger = logging.getLogger(name)
    logger.setLevel(default_level)
    ch = logging.StreamHandler()
    ch.setLevel(default_level)
    formatter = logging.Formatter(
        "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    )
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    return logger