LogQueue extends ConcurrentLinkedQueue<LogEvent> implements LoggerTail { @Override public void error(String msg) { error((Marker) null, msg); }  @Override void log(org.slf4j.Logger targetLogger); LogEvent addLogEvent(LogLevel level, String format, Object[] arguments); LogEvent addLogEvent(Marker marker, LogLevel level, String format, Object[] arguments); LogEvent addLogEvent(LogLevel level, String format, Object[] arguments, Throwable throwable); LogEvent addLogEvent(Marker marker, LogLevel level, String format, Object[] arguments, Throwable throwable); @Override void log(LogEvent logEvent); @Override LogEvent getLogEvent(int index); @Override LogEvent getFirstLogEvent(LogLevel from); @Override LogEvent getLastLogEvent(LogLevel from); @Override LogTailResult getLogEvents(LogLevel from, int offset, int limit); @Override boolean hasLogLevel(LogLevel from); List<LogEvent> getLogs(LogLevel level); List<LogEvent> getLogsFrom(LogLevel level); boolean containLogsFrom(LogLevel level); @Override String getName(); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Object arg1, Object arg2); @Override void trace(String format, Object... arguments); @Override void trace(String msg, Throwable t); @Override boolean isTraceEnabled(Marker marker); @Override void trace(Marker marker, String msg); @Override void trace(Marker marker, String format, Object arg); @Override void trace(Marker marker, String format, Object arg1, Object arg2); @Override void trace(Marker marker, String format, Object... arguments); @Override void trace(Marker marker, String msg, Throwable t); @Override boolean isDebugEnabled(); @Override void debug(String msg); @Override void debug(String format, Object arg); @Override void debug(String format, Object arg1, Object arg2); @Override void debug(String format, Object... arguments); @Override void debug(String msg, Throwable t); @Override boolean isDebugEnabled(Marker marker); @Override void debug(Marker marker, String msg); @Override void debug(Marker marker, String format, Object arg); @Override void debug(Marker marker, String format, Object arg1, Object arg2); @Override void debug(Marker marker, String format, Object... arguments); @Override void debug(Marker marker, String msg, Throwable t); @Override boolean isInfoEnabled(); @Override void info(String msg); @Override void info(String format, Object arg); @Override void info(String format, Object arg1, Object arg2); @Override void info(String format, Object... arguments); @Override void info(String msg, Throwable t); @Override boolean isInfoEnabled(Marker marker); @Override void info(Marker marker, String msg); @Override void info(Marker marker, String format, Object arg); @Override void info(Marker marker, String format, Object arg1, Object arg2); @Override void info(Marker marker, String format, Object... arguments); @Override void info(Marker marker, String msg, Throwable t); @Override boolean isWarnEnabled(); @Override void warn(String msg); @Override void warn(String format, Object arg); @Override void warn(String format, Object arg1, Object arg2); @Override void warn(String format, Object... arguments); @Override void warn(String msg, Throwable t); @Override boolean isWarnEnabled(Marker marker); @Override void warn(Marker marker, String msg); @Override void warn(Marker marker, String format, Object arg); @Override void warn(Marker marker, String format, Object arg1, Object arg2); @Override void warn(Marker marker, String format, Object... arguments); @Override void warn(Marker marker, String msg, Throwable t); @Override boolean isErrorEnabled(); @Override void error(String msg); @Override void error(String format, Object arg); @Override void error(String format, Object arg1, Object arg2); @Override void error(String format, Object... arguments); @Override void error(String msg, Throwable t); @Override boolean isErrorEnabled(Marker marker); @Override void error(Marker marker, String msg); @Override void error(Marker marker, String format, Object arg); @Override void error(Marker marker, String format, Object arg1, Object arg2); @Override void error(Marker marker, String format, Object... arguments); @Override void error(Marker marker, String msg, Throwable t); @Override void flush(); @Override void close();  }
@Test void error() { LogQueue queue = new LogQueue(); LogEvent logEvent; queue.error(""); logEvent = queue.poll(); assertEquals(Arrays.asList(""), logEvent.getMessageElements()); assertEquals("", logEvent.getFormattedMessage()); queue.error("message"); assertEquals("message", queue.poll().getFormattedMessage()); queue.error("message {}", "param"); assertEquals("message param", queue.poll().getFormattedMessage()); queue.error("message {} {}", "param1", "param2"); logEvent = queue.poll(); assertEquals("message param1 param2", logEvent.getFormattedMessage()); assertEquals(Arrays.asList("message ", " ", ""), logEvent.getMessageElements()); assertEquals(Arrays.asList("param1", "param2"), Arrays.asList(logEvent.getArgumentArray())); queue.error("message {}", "param1", new Exception()); logEvent = queue.poll(); assertEquals("message param1", logEvent.getFormattedMessage()); assertEquals(Arrays.asList("message ", ""), logEvent.getMessageElements()); assertEquals(Arrays.asList("param1"), Arrays.asList(logEvent.getArgumentArray())); assertNotNull(logEvent.getThrowable()); assertNull(logEvent.getTranslationKey()); queue.error("message {}", new Object[]{ "param1", new Exception() }); logEvent = queue.poll(); assertEquals("message param1", logEvent.getFormattedMessage()); assertEquals(Arrays.asList("message ", ""), logEvent.getMessageElements()); assertEquals(Arrays.asList("param1"), Arrays.asList(logEvent.getArgumentArray())); assertNotNull(logEvent.getThrowable()); assertNull(logEvent.getTranslationKey()); queue.error(new TranslationMarker("translation.key"), "message"); logEvent = queue.poll(); assertEquals("translation.key", logEvent.getTranslationKey()); assertEquals(Arrays.asList("message"), logEvent.getMessageElements()); assertEquals(Arrays.asList(), Arrays.asList(logEvent.getArgumentArray())); }