import logging

def setup_logger(log_file='logging.log', level=logging.INFO):
    """Set up logging."""
    
    # Configure logger
    logging.basicConfig(level=level,
                        format='%(asctime)s [%(levelname)s] - %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S',
                        handlers=[logging.FileHandler(log_file, 'a', 'utf-8'),
                                logging.StreamHandler()])
    
    logger = logging.getLogger()
    
    return logger

def print_and_log(logger, msg):
    try:
        logger.info(msg)
    except:
        print(msg)