@Test void testLog() throws IOException { FlatLogListener listener = new FlatLogListener(); LogEvent ev = new LogEvent(); ev.setNoArmor(true); ev.addMessage("Test"); ev.addMessage("More"); LogEvent r = listener.log(ev); ByteArrayOutputStream captureStream = new ByteArrayOutputStream(); PrintStream capturePrintStream = new PrintStream(captureStream); r.dump(capturePrintStream, ""); BufferedReader reader = new BufferedReader( new InputStreamReader(new ByteArrayInputStream(captureStream.toByteArray()))); assertEquals(" <info> Test More </info>", reader.readLine()); capturePrintStream.close(); reader.close(); }
@Override public synchronized LogEvent log(LogEvent ev) { ev.dump(p, ""); byte[] result = mapper.apply(captureStream.toByteArray()); captureStream.reset(); return new FrozenLogEvent(new String(result)); }
FlatLogListener implements LogListener, Configurable, Destroyable { @Override public synchronized LogEvent log(LogEvent ev) { ev.dump(p, ""); byte[] result = mapper.apply(captureStream.toByteArray()); captureStream.reset(); return new FrozenLogEvent(new String(result)); } }
FlatLogListener implements LogListener, Configurable, Destroyable { @Override public synchronized LogEvent log(LogEvent ev) { ev.dump(p, ""); byte[] result = mapper.apply(captureStream.toByteArray()); captureStream.reset(); return new FrozenLogEvent(new String(result)); }  }
FlatLogListener implements LogListener, Configurable, Destroyable { @Override public synchronized LogEvent log(LogEvent ev) { ev.dump(p, ""); byte[] result = mapper.apply(captureStream.toByteArray()); captureStream.reset(); return new FrozenLogEvent(new String(result)); }  @Override void setConfiguration(Configuration cfg); @Override synchronized LogEvent log(LogEvent ev); @Override void destroy(); }
FlatLogListener implements LogListener, Configurable, Destroyable { @Override public synchronized LogEvent log(LogEvent ev) { ev.dump(p, ""); byte[] result = mapper.apply(captureStream.toByteArray()); captureStream.reset(); return new FrozenLogEvent(new String(result)); }  @Override void setConfiguration(Configuration cfg); @Override synchronized LogEvent log(LogEvent ev); @Override void destroy();  }