class Converter {

    public Timber.LogEvent convertFrom(LogRecord rec) {
        Timber.LogEvent.Builder eventBuilder =  Timber.LogEvent.newBuilder()
            .setTimestamp(rec.getMillis())
            .setConsistencyLevel(ConsistencyLevel.BESTEFFORT)
            .setLevel(rec.getLevel().intValue())
            .setHost(hostName)
            .setServiceName(serviceName)
            .setSource(rec.getSourceClassName() + "#" + rec.getSourceMethodName())
            .setPid(0)
            .setTid(rec.getThreadID())
            .setType("T")
            .addPayload(
                Timber.Payload.newBuilder()
                .setName("msg")
                .setPayload(ByteString.copyFromUtf8(rec.getMessage())));

        // Check if we have an exception
        Throwable cause = rec.getThrown();
        if (cause != null) {
            // Awkward
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            cause.printStackTrace(new PrintStream(os));

            eventBuilder.addPayload(
                Timber.Payload.newBuilder()
                .setName("exception")
                .setContentType("application/java-exception")
                .setPayload(ByteString.copyFrom(os.toByteArray()))
            );
        }

        return eventBuilder.build();
    }

    public  Converter(String serviceName);

}