def to_file(output_file, encoder=EliotJSONEncoder):
    """
    Add a destination that writes a JSON message per line to the given file.

    @param output_file: A file-like object.

    @param encoder: A JSONEncoder subclass to use when encoding JSON.
    """
    Logger._destinations.add(FileDestination(file=output_file, encoder=encoder))