import logging


def get_logger(name="urlchecker", level=logging.INFO):
    """
    Get a default logger for the urlchecker library, meaning
    that we use name "urlchecker" and use the default logging
    level INFO

    Parameters:
      - name: the name for the logger (defaults to urlchecker)
      - level: the logging.<level> to set with setLevel()

    Returns: logging logger
    """

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

    # Stream handler
    ch = logging.StreamHandler()
    ch.setLevel(logging.ERROR)

    # formatting
    formatter = logging.Formatter(
        "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    )
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    return logger