@Test public void testTraceToken() throws IOException { try { TraceTokenManager.createAndRegisterNewRequestToken("property", "value"); handler.audit(new AutoValue_TestFileAuditLogger_TestingRecord("foovalue")); factory.close(); String actual = Files.asCharSource(file, UTF_8).read(); assertEquals(actual, "{\"time\":\"" + ISO_INSTANT.format(dateTimeSupplier.get()) + "\"," + "\"type\":\"com.proofpoint.audit.TestFileAuditLogger.TestingRecord\"," + "\"traceToken\":{\"id\":\"" + TraceTokenManager.getCurrentTraceToken().get("id") + "\",\"property\":\"value\"}," + "\"foo\":\"foovalue\"}\n"); } finally { TraceTokenManager.clearRequestToken(); } }
@Override public void audit(T record) { try { fileAppender.doAppend(auditWrapper(dateTimeSupplier.get(), type, record)); } catch (Exception ignored) { } }
FileAuditLogger implements AuditLogger<T> { @Override public void audit(T record) { try { fileAppender.doAppend(auditWrapper(dateTimeSupplier.get(), type, record)); } catch (Exception ignored) { } } }
FileAuditLogger implements AuditLogger<T> { @Override public void audit(T record) { try { fileAppender.doAppend(auditWrapper(dateTimeSupplier.get(), type, record)); } catch (Exception ignored) { } } FileAuditLogger(Class<T> recordClass, DateTimeSupplier dateTimeSupplier, Appender<AuditWrapper> fileAppender); }
FileAuditLogger implements AuditLogger<T> { @Override public void audit(T record) { try { fileAppender.doAppend(auditWrapper(dateTimeSupplier.get(), type, record)); } catch (Exception ignored) { } } FileAuditLogger(Class<T> recordClass, DateTimeSupplier dateTimeSupplier, Appender<AuditWrapper> fileAppender); @Override void audit(T record); }
FileAuditLogger implements AuditLogger<T> { @Override public void audit(T record) { try { fileAppender.doAppend(auditWrapper(dateTimeSupplier.get(), type, record)); } catch (Exception ignored) { } } FileAuditLogger(Class<T> recordClass, DateTimeSupplier dateTimeSupplier, Appender<AuditWrapper> fileAppender); @Override void audit(T record);  }