class LogJobFactory implements AsynchronousSpanSink.JobFactory {

    public static LogJobFactory withFile(final String file) throws IOException {
        // We try and open the file for append to get early warning of misconfiguration, it will fail is file is not
        // writable.
        try (FileOutputStream ignored = new FileOutputStream(file, true)) {
            return withWriterProvider(new WriterProvider() {
                @Override
                public Writer getWriter() throws IOException {
                    return new OutputStreamWriter(new FileOutputStream(file, true), Charset.forName("UTF-8").newEncoder());
                }
            });
        }
    }

    private  LogJobFactory(WriterProvider writerProvider);

}