@Test public void testCreateWithFileSucceedsIfWriteable() throws Exception { LogJobFactory.withFile("sample.log"); }
public static LogJobFactory withFile(final String file) throws IOException { 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()); } }); } }
LogJobFactory implements AsynchronousSpanSink.JobFactory { public static LogJobFactory withFile(final String file) throws IOException { 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()); } }); } } }
LogJobFactory implements AsynchronousSpanSink.JobFactory { public static LogJobFactory withFile(final String file) throws IOException { 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); }
LogJobFactory implements AsynchronousSpanSink.JobFactory { public static LogJobFactory withFile(final String file) throws IOException { 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); static LogJobFactory withWriter(final Writer writer); static LogJobFactory withFile(final String file); @Override Runnable createJob(SpanData data); }
LogJobFactory implements AsynchronousSpanSink.JobFactory { public static LogJobFactory withFile(final String file) throws IOException { 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); static LogJobFactory withWriter(final Writer writer); static LogJobFactory withFile(final String file); @Override Runnable createJob(SpanData data);  }