@Test public void testWithArgumentsAndMetadata() { LogData data = FakeLogData.withPrintfStyle("Foo='%s'", "bar") .setTimestampNanos(123456789000L) .addMetadata(COUNT_KEY, 23) .addMetadata(ID_KEY, "test ID"); LogRecord record = SimpleLogRecord.create(data); assertThat(record.getLevel()).isEqualTo(Level.INFO); assertThat(record.getMessage()).isEqualTo("Foo='bar' [CONTEXT count=23 id=\"test ID\" ]"); assertThat(record.getParameters()).isNull(); record.setMillis(123456789); assertThat(record.toString()) .isEqualTo( "SimpleLogRecord {\n" + " message: Foo='bar' [CONTEXT count=23 id=\"test ID\" ]\n" + " arguments: <none>\n" + " original message: Foo='%s'\n" + " original arguments:\n" + " bar\n" + " metadata:\n" + " count: 23\n" + " id: test ID\n" + " level: INFO\n" + " timestamp (nanos): 123456789000\n" + " class: com.google.FakeClass\n" + " method: fakeMethod\n" + " line number: 123\n" + "}"); }
public static SimpleLogRecord create(LogData data) { return new SimpleLogRecord(data); }
SimpleLogRecord extends AbstractLogRecord implements SimpleLogHandler { public static SimpleLogRecord create(LogData data) { return new SimpleLogRecord(data); } }
SimpleLogRecord extends AbstractLogRecord implements SimpleLogHandler { public static SimpleLogRecord create(LogData data) { return new SimpleLogRecord(data); } private  SimpleLogRecord(LogData data); private  SimpleLogRecord(RuntimeException error, LogData data); }
SimpleLogRecord extends AbstractLogRecord implements SimpleLogHandler { public static SimpleLogRecord create(LogData data) { return new SimpleLogRecord(data); } private  SimpleLogRecord(LogData data); private  SimpleLogRecord(RuntimeException error, LogData data); static SimpleLogRecord create(LogData data); static SimpleLogRecord error(RuntimeException error, LogData data); @Override void handleFormattedLogMessage(Level level, String message, @NullableDecl Throwable thrown); }
SimpleLogRecord extends AbstractLogRecord implements SimpleLogHandler { public static SimpleLogRecord create(LogData data) { return new SimpleLogRecord(data); } private  SimpleLogRecord(LogData data); private  SimpleLogRecord(RuntimeException error, LogData data); static SimpleLogRecord create(LogData data); static SimpleLogRecord error(RuntimeException error, LogData data); @Override void handleFormattedLogMessage(Level level, String message, @NullableDecl Throwable thrown);  }