LogPrinter { public LogPrinter() { this(DateTimeFormatter.ISO_INSTANT, Charset.defaultCharset()); } LogPrinter();  LogPrinter(final Charset charset);  LogPrinter(final DateTimeFormatter fmt, final Charset charset); ConfigurableAppenderSupplier getAppenderSupplier(); OutputStream print(final Slf4jLogRecord record, final OutputStream os, final OutputStream errStream); void print(final Slf4jLogRecord record, final OutputStream os); byte[] printToBytes(final Slf4jLogRecord record); void print(final LogRecord record, final OutputStream os); void printTo(final StringBuilder sb, final Slf4jLogRecord record, final String annotate); void printTo(final OutputStream stream, final LogRecord record, final String annotate); void printTo(final PrintStream stream, final Slf4jLogRecord record, final String annotate); @Override String toString();  }
@Test public void testLogPrinter() throws UnsupportedEncodingException { LogPrinter printer = new LogPrinter(DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneId.of("Z")), StandardCharsets.UTF_8); ByteArrayOutputStream bos = new ByteArrayOutputStream(); printer.print(new Slf4jLogRecordImpl("test", Level.DEBUG, "my message {} {} ", "1", "2", "3"), bos); String logMsg = bos.toString(StandardCharsets.UTF_8.name()); Assert.assertThat(logMsg, Matchers.containsString("DEBUG test \"main\" \"my message 1 2 \" [\"3\"]")); }