import json
import logging


def read_login_info(file_name):
    """
    Read the local login info from file. Pass through the file name.
    Return user_info as json if succeed, or return boolean False if failed.
    """
    try:
        with open(file_name, 'r', encoding='utf-8') as file:
            try:
                login_info: list = json.load(file)
                logging.info("Successfully read the local user info.")
                return login_info
            except json.decoder.JSONDecodeError:
                return False
    except FileNotFoundError:
        logging.info("Did not find local user info. Ask for input instead.")
        return False