def METHOD_NAME(log_file):
    # set up log file, or print to screen (default)
    if log_file:
        log = logging.getLogger()
        log.setLevel(logging.INFO)
        # set up log file
        log.addHandler(logging.FileHandler(log_file))
        # restart log, in case log file already exists
        with open(log_file, 'w'):
            pass
        # log to file and screen
        def logger(msg):
            log.log(logging.INFO, msg)
            print(msg)
    else:
        # log to screen only
        def logger(msg):
            print(msg)
    return logger