@Test public void build_shouldReturnACorrectlyConfiguredBasicOpsLoggerToSystemOut_whenNoConfigurationIsPerformed() throws Exception { OpsLogger<TestMessages> logger = new OpsLoggerFactory().build(); BasicOpsLogger<TestMessages> basicLogger = (BasicOpsLogger<TestMessages>) logger; assertThat(basicLogger.getDestination(), instanceOf(OutputStreamDestination.class)); assertEquals(InfrastructureFactory.EMPTY_CONTEXT_SUPPLIER, basicLogger.getDiagnosticContextSupplier()); OutputStreamDestination<TestMessages> destination = (OutputStreamDestination<TestMessages>) basicLogger.getDestination(); assertSame(System.out, destination.getOutput()); assertThat(destination.getStackTraceProcessor(), instanceOf(SimpleStackTraceProcessor.class)); ensureCorrectlyConfigured(basicLogger); }
@SuppressWarnings("unchecked") public <T extends Enum<T> & LogMessage> OpsLogger<T> build() throws UncheckedIOException { if (!cachedInstance.isPresent()) { cachedInstance = Optional.of(buildNewInstance()); } return (OpsLogger<T>) cachedInstance.get(); }
OpsLoggerFactory { @SuppressWarnings("unchecked") public <T extends Enum<T> & LogMessage> OpsLogger<T> build() throws UncheckedIOException { if (!cachedInstance.isPresent()) { cachedInstance = Optional.of(buildNewInstance()); } return (OpsLogger<T>) cachedInstance.get(); } }
OpsLoggerFactory { @SuppressWarnings("unchecked") public <T extends Enum<T> & LogMessage> OpsLogger<T> build() throws UncheckedIOException { if (!cachedInstance.isPresent()) { cachedInstance = Optional.of(buildNewInstance()); } return (OpsLogger<T>) cachedInstance.get(); }  }
OpsLoggerFactory { @SuppressWarnings("unchecked") public <T extends Enum<T> & LogMessage> OpsLogger<T> build() throws UncheckedIOException { if (!cachedInstance.isPresent()) { cachedInstance = Optional.of(buildNewInstance()); } return (OpsLogger<T>) cachedInstance.get(); }  OpsLoggerFactory setDestination(PrintStream printStream); OpsLoggerFactory setPath(Path path); OpsLoggerFactory setStoreStackTracesInFilesystem(boolean store); OpsLoggerFactory setStackTraceStoragePath(Path directory); OpsLoggerFactory setErrorHandler(Consumer<Throwable> handler); @Deprecated OpsLoggerFactory setCorrelationIdSupplier(Supplier<Map<String,String>> supplier); OpsLoggerFactory setGlobalDiagnosticContextSupplier(DiagnosticContextSupplier supplier); OpsLoggerFactory setAsync(boolean async); @SuppressWarnings("unchecked") OpsLogger<T> build(); }
OpsLoggerFactory { @SuppressWarnings("unchecked") public <T extends Enum<T> & LogMessage> OpsLogger<T> build() throws UncheckedIOException { if (!cachedInstance.isPresent()) { cachedInstance = Optional.of(buildNewInstance()); } return (OpsLogger<T>) cachedInstance.get(); }  OpsLoggerFactory setDestination(PrintStream printStream); OpsLoggerFactory setPath(Path path); OpsLoggerFactory setStoreStackTracesInFilesystem(boolean store); OpsLoggerFactory setStackTraceStoragePath(Path directory); OpsLoggerFactory setErrorHandler(Consumer<Throwable> handler); @Deprecated OpsLoggerFactory setCorrelationIdSupplier(Supplier<Map<String,String>> supplier); OpsLoggerFactory setGlobalDiagnosticContextSupplier(DiagnosticContextSupplier supplier); OpsLoggerFactory setAsync(boolean async); @SuppressWarnings("unchecked") OpsLogger<T> build();  }