def log(filename, message, verbose):
    """write message to log file and shell."""
    if verbose:
        print(message)
    if filename:
        output = open(filename, 'a')
        output.write(message + '\n')
        output.close()
