LevelConverter extends ClassicConverter { @Override public String convert(ILoggingEvent event) { final Marker marker = event.getMarker(); return marker == null ? (event.getLevel() == null ? "" : event.getLevel().toString()) : marker.getName(); }  @Override String convert(ILoggingEvent event);  }
@Test public void testConvert() { final LevelConverter converter = new LevelConverter(); assertEquals("Unexpected convertion", "", converter.convert(new MockILoggingEvent())); assertEquals("Unexpected convertion", "", converter.convert(new MockILoggingEvent(null, null, "message"))); assertEquals("Unexpected convertion", "INFO", converter.convert(new MockILoggingEvent(Level.INFO, null, "message"))); assertEquals("Unexpected convertion", "mark", converter.convert(new MockILoggingEvent(null, MarkerFactory.getMarker("mark"), "message"))); assertEquals("Unexpected convertion", "mark", converter.convert(new MockILoggingEvent(Level.INFO, MarkerFactory.getMarker("mark"), "message"))); }