@Test public void simpleTest() throws Exception { FullFormatter form = new FullFormatter(); assertEquals(eventString, form.format(event)); }
@Override public String format(Timber.LogEvent logEvent) { StringBuilder buff = new StringBuilder(200); Util.formatTimeISO(logEvent.getTimestamp(), buff); buff.append('\t') .append(logEvent.getHost()) .append('\t') .append((logEvent.hasPid() ? logEvent.getPid() : "-")) .append("/") .append((logEvent.hasTid() ? logEvent.getTid() : "-")) .append('\t') .append(logEvent.getServiceName()) .append('\t') .append(classFromSource(logEvent.getSource())) .append('\t') .append(logEvent.getType()) .append('\t') .append(Util.logLevelNameForValue(logEvent.getLevel())) .append('\t') .append(logEvent.getConsistencyLevel().toString().substring(0,2)) .append('\t'); boolean first = true; for (Timber.Payload payload : logEvent.getPayloadList()) { String s = payload.getPayload().toStringUtf8(); buff.append((first?"":" | ")) .append(payload.getName()) .append(": ") .append(Util.escape(s)); first = false; } return buff.toString(); }
FullFormatter implements LogEventFormatter { @Override public String format(Timber.LogEvent logEvent) { StringBuilder buff = new StringBuilder(200); Util.formatTimeISO(logEvent.getTimestamp(), buff); buff.append('\t') .append(logEvent.getHost()) .append('\t') .append((logEvent.hasPid() ? logEvent.getPid() : "-")) .append("/") .append((logEvent.hasTid() ? logEvent.getTid() : "-")) .append('\t') .append(logEvent.getServiceName()) .append('\t') .append(classFromSource(logEvent.getSource())) .append('\t') .append(logEvent.getType()) .append('\t') .append(Util.logLevelNameForValue(logEvent.getLevel())) .append('\t') .append(logEvent.getConsistencyLevel().toString().substring(0,2)) .append('\t'); boolean first = true; for (Timber.Payload payload : logEvent.getPayloadList()) { String s = payload.getPayload().toStringUtf8(); buff.append((first?"":" | ")) .append(payload.getName()) .append(": ") .append(Util.escape(s)); first = false; } return buff.toString(); } }
FullFormatter implements LogEventFormatter { @Override public String format(Timber.LogEvent logEvent) { StringBuilder buff = new StringBuilder(200); Util.formatTimeISO(logEvent.getTimestamp(), buff); buff.append('\t') .append(logEvent.getHost()) .append('\t') .append((logEvent.hasPid() ? logEvent.getPid() : "-")) .append("/") .append((logEvent.hasTid() ? logEvent.getTid() : "-")) .append('\t') .append(logEvent.getServiceName()) .append('\t') .append(classFromSource(logEvent.getSource())) .append('\t') .append(logEvent.getType()) .append('\t') .append(Util.logLevelNameForValue(logEvent.getLevel())) .append('\t') .append(logEvent.getConsistencyLevel().toString().substring(0,2)) .append('\t'); boolean first = true; for (Timber.Payload payload : logEvent.getPayloadList()) { String s = payload.getPayload().toStringUtf8(); buff.append((first?"":" | ")) .append(payload.getName()) .append(": ") .append(Util.escape(s)); first = false; } return buff.toString(); }  }
FullFormatter implements LogEventFormatter { @Override public String format(Timber.LogEvent logEvent) { StringBuilder buff = new StringBuilder(200); Util.formatTimeISO(logEvent.getTimestamp(), buff); buff.append('\t') .append(logEvent.getHost()) .append('\t') .append((logEvent.hasPid() ? logEvent.getPid() : "-")) .append("/") .append((logEvent.hasTid() ? logEvent.getTid() : "-")) .append('\t') .append(logEvent.getServiceName()) .append('\t') .append(classFromSource(logEvent.getSource())) .append('\t') .append(logEvent.getType()) .append('\t') .append(Util.logLevelNameForValue(logEvent.getLevel())) .append('\t') .append(logEvent.getConsistencyLevel().toString().substring(0,2)) .append('\t'); boolean first = true; for (Timber.Payload payload : logEvent.getPayloadList()) { String s = payload.getPayload().toStringUtf8(); buff.append((first?"":" | ")) .append(payload.getName()) .append(": ") .append(Util.escape(s)); first = false; } return buff.toString(); }  @Override String format(Timber.LogEvent logEvent); }
FullFormatter implements LogEventFormatter { @Override public String format(Timber.LogEvent logEvent) { StringBuilder buff = new StringBuilder(200); Util.formatTimeISO(logEvent.getTimestamp(), buff); buff.append('\t') .append(logEvent.getHost()) .append('\t') .append((logEvent.hasPid() ? logEvent.getPid() : "-")) .append("/") .append((logEvent.hasTid() ? logEvent.getTid() : "-")) .append('\t') .append(logEvent.getServiceName()) .append('\t') .append(classFromSource(logEvent.getSource())) .append('\t') .append(logEvent.getType()) .append('\t') .append(Util.logLevelNameForValue(logEvent.getLevel())) .append('\t') .append(logEvent.getConsistencyLevel().toString().substring(0,2)) .append('\t'); boolean first = true; for (Timber.Payload payload : logEvent.getPayloadList()) { String s = payload.getPayload().toStringUtf8(); buff.append((first?"":" | ")) .append(payload.getName()) .append(": ") .append(Util.escape(s)); first = false; } return buff.toString(); }  @Override String format(Timber.LogEvent logEvent);  }