@Test public void testToStringWithArgumentsAndMetadata() { LogData data = FakeLogData.withPrintfStyle("Foo='%s'", "bar") .setTimestampNanos(123456789000L) .addMetadata(COUNT_KEY, 23) .addMetadata(ID_KEY, "test ID"); SimpleLogEvent logEvent = newSimpleLogEvent(data); assertThat(logEvent.toString()) .isEqualTo( "SimpleLogEvent {\n" + " message: Foo='bar' [CONTEXT count=23 id=\"test ID\" ]\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" + "}"); }
@Override public String toString() { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()).append(" {\n message: ").append(message).append('\n'); LogDataFormatter.appendLogData(logData, out); out.append("\n}"); return out.toString(); }
SimpleLogEvent implements SimpleLogHandler { @Override public String toString() { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()).append(" {\n message: ").append(message).append('\n'); LogDataFormatter.appendLogData(logData, out); out.append("\n}"); return out.toString(); } }
SimpleLogEvent implements SimpleLogHandler { @Override public String toString() { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()).append(" {\n message: ").append(message).append('\n'); LogDataFormatter.appendLogData(logData, out); out.append("\n}"); return out.toString(); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); }
SimpleLogEvent implements SimpleLogHandler { @Override public String toString() { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()).append(" {\n message: ").append(message).append('\n'); LogDataFormatter.appendLogData(logData, out); out.append("\n}"); return out.toString(); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); @Override void handleFormattedLogMessage(
      java.util.logging.Level level, String message, Throwable thrown); @Override String toString(); }
SimpleLogEvent implements SimpleLogHandler { @Override public String toString() { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()).append(" {\n message: ").append(message).append('\n'); LogDataFormatter.appendLogData(logData, out); out.append("\n}"); return out.toString(); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); @Override void handleFormattedLogMessage(
      java.util.logging.Level level, String message, Throwable thrown); @Override String toString();  }