LoggerImpl extends AbstractLogger { static String abbreviateLoggerName(String name) { String[] tokens = Strings.split(name, '.'); var builder = new StringBuilder(); int abbrCount = tokens.length <= 4 ? tokens.length - 1 : tokens.length - 2; for (int i = 0; i < tokens.length; i++) { String token = tokens[i]; if (i > 0) builder.append('.'); if (i < abbrCount && token.length() >= 1) { builder.append(token.charAt(0)); } else { builder.append(token); } } return builder.toString(); } LoggerImpl(String name, LogLevel infoLevel, LogLevel traceLevel); @Override void log(Marker marker, LogLevel level, String message, Object[] arguments, Throwable exception);  }
@Test void abbreviateLoggerName() { assertThat(LoggerImpl.abbreviateLoggerName("Bean")).isEqualTo("Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.Bean")).isEqualTo("c.Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.framework.Bean")).isEqualTo("c.f.Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.framework.api.Bean")).isEqualTo("c.f.a.Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.framework.api.module.Bean")).isEqualTo("c.f.a.module.Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.framework.api.module.service.Bean")).isEqualTo("c.f.a.m.service.Bean"); assertThat(LoggerImpl.abbreviateLoggerName("core.framework.api.module.service.impl.Bean")).isEqualTo("c.f.a.m.s.impl.Bean"); }