@Test public void testTextEvent() throws Exception { Timber.LogEvent event = LogUtil.textEvent(20, "some.service", "the.source", "the message"); assertEquals(20, event.getLevel()); assertEquals("some.service", event.getServiceName()); assertEquals("the.source", event.getSource()); assertEquals("the message", event.getPayload(0).getPayload().toStringUtf8()); assertTrue((System.currentTimeMillis() - event.getTimestamp()) < 10); }
public static Timber.LogEvent textEvent(int level, String service, String source, String message) { return Timber.LogEvent.newBuilder() .setTimestamp(System.currentTimeMillis()) .setConsistencyLevel(ConsistencyLevel.BESTEFFORT) .setLevel(level) .setHost(hostName) .setServiceName(service) .setSource(source) .setPid(0) .setTid((int) Thread.currentThread().getId()) .setType("T") .addPayload( Timber.Payload.newBuilder() .setName("msg") .setPayload(ByteString.copyFromUtf8(message))) .build(); }
LogUtil { public static Timber.LogEvent textEvent(int level, String service, String source, String message) { return Timber.LogEvent.newBuilder() .setTimestamp(System.currentTimeMillis()) .setConsistencyLevel(ConsistencyLevel.BESTEFFORT) .setLevel(level) .setHost(hostName) .setServiceName(service) .setSource(source) .setPid(0) .setTid((int) Thread.currentThread().getId()) .setType("T") .addPayload( Timber.Payload.newBuilder() .setName("msg") .setPayload(ByteString.copyFromUtf8(message))) .build(); } }
LogUtil { public static Timber.LogEvent textEvent(int level, String service, String source, String message) { return Timber.LogEvent.newBuilder() .setTimestamp(System.currentTimeMillis()) .setConsistencyLevel(ConsistencyLevel.BESTEFFORT) .setLevel(level) .setHost(hostName) .setServiceName(service) .setSource(source) .setPid(0) .setTid((int) Thread.currentThread().getId()) .setType("T") .addPayload( Timber.Payload.newBuilder() .setName("msg") .setPayload(ByteString.copyFromUtf8(message))) .build(); }  }
LogUtil { public static Timber.LogEvent textEvent(int level, String service, String source, String message) { return Timber.LogEvent.newBuilder() .setTimestamp(System.currentTimeMillis()) .setConsistencyLevel(ConsistencyLevel.BESTEFFORT) .setLevel(level) .setHost(hostName) .setServiceName(service) .setSource(source) .setPid(0) .setTid((int) Thread.currentThread().getId()) .setType("T") .addPayload( Timber.Payload.newBuilder() .setName("msg") .setPayload(ByteString.copyFromUtf8(message))) .build(); }  static Timber.LogEvent textEvent(int level,
                                            String service,
                                            String source,
                                            String message); static String getHostName(); }
LogUtil { public static Timber.LogEvent textEvent(int level, String service, String source, String message) { return Timber.LogEvent.newBuilder() .setTimestamp(System.currentTimeMillis()) .setConsistencyLevel(ConsistencyLevel.BESTEFFORT) .setLevel(level) .setHost(hostName) .setServiceName(service) .setSource(source) .setPid(0) .setTid((int) Thread.currentThread().getId()) .setType("T") .addPayload( Timber.Payload.newBuilder() .setName("msg") .setPayload(ByteString.copyFromUtf8(message))) .build(); }  static Timber.LogEvent textEvent(int level,
                                            String service,
                                            String source,
                                            String message); static String getHostName();  }