Logger { public static void debug(final Object message) { if (MINIMUM_LEVEL_COVERS_DEBUG) { provider.log(STACKTRACE_DEPTH, null, org.tinylog.Level.DEBUG, null, null, message, (Object[]) null); } } private  Logger(); static Level getLevel(); static Level getLevel(final Package packageObject); static Level getLevel(final Class<?> classObject); static void trace(final Object message); static void trace(final String message); static void trace(final Supplier<?> message); static void trace(final String message, final Object... arguments); static void trace(final String message, final Supplier<?>... arguments); static void trace(final Throwable exception); static void trace(final Throwable exception, final String message); static void trace(final Throwable exception, final Supplier<String> message); static void trace(final Throwable exception, final String message, final Object... arguments); static void trace(final Throwable exception, final String message, final Supplier<?>... arguments); static void debug(final Object message); static void debug(final String message); static void debug(final Supplier<?> message); static void debug(final String message, final Object... arguments); static void debug(final String message, final Supplier<?>... arguments); static void debug(final Throwable exception); static void debug(final Throwable exception, final String message); static void debug(final Throwable exception, final Supplier<String> message); static void debug(final Throwable exception, final String message, final Object... arguments); static void debug(final Throwable exception, final String message, final Supplier<?>... arguments); static void info(final Object message); static void info(final String message); static void info(final Supplier<?> message); static void info(final String message, final Object... arguments); static void info(final String message, final Supplier<?>... arguments); static void info(final Throwable exception); static void info(final Throwable exception, final String message); static void info(final Throwable exception, final Supplier<String> message); static void info(final Throwable exception, final String message, final Object... arguments); static void info(final Throwable exception, final String message, final Supplier<?>... arguments); static void warn(final Object message); static void warn(final String message); static void warn(final Supplier<?> message); static void warn(final String message, final Object... arguments); static void warn(final String message, final Supplier<?>... arguments); static void warn(final Throwable exception); static void warn(final Throwable exception, final String message); static void warn(final Throwable exception, final Supplier<String> message); static void warn(final Throwable exception, final String message, final Object... arguments); static void warn(final Throwable exception, final String message, final Supplier<?>... arguments); static void error(final Object message); static void error(final String message); static void error(final Supplier<?> message); static void error(final String message, final Object... arguments); static void error(final String message, final Supplier<?>... arguments); static void error(final Throwable exception); static void error(final Throwable exception, final String message); static void error(final Throwable exception, final Supplier<String> message); static void error(final Throwable exception, final String message, final Object... arguments); static void error(final Throwable exception, final String message, final Supplier<?>... arguments);  }
@Test public void debugObject() { Logger.debug(42); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, null, null, 42, (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugMessage() { Logger.debug("Hello World!"); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, null, null, "Hello World!", (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugLazyMessage() { Supplier<String> supplier = mockSupplier("Hello World!"); Logger.debug(supplier); verify(supplier, never()).get(); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, null, null, supplier, (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugMessageAndArguments() { Logger.debug("Hello {}!", "World"); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), isNull(), any(AdvancedMessageFormatter.class), eq("Hello {}!"), eq("World")); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugMessageAndLazyArguments() { Supplier<Integer> supplier = mockSupplier(42); Logger.debug("The number is {}", supplier); verify(supplier, never()).get(); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), isNull(), any(AdvancedMessageFormatter.class), eq("The number is {}"), eq(supplier)); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugException() { Exception exception = new NullPointerException(); Logger.debug(exception); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, exception, null, null, (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugExceptionWithMessage() { Exception exception = new NullPointerException(); Logger.debug(exception, "Hello World!"); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, exception, null, "Hello World!", (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugExceptionWithLazyMessage() { Exception exception = new NullPointerException(); Supplier<String> supplier = mockSupplier("Hello World!"); Logger.debug(exception, supplier); verify(supplier, never()).get(); if (debugEnabled) { verify(provider).log(2, null, Level.DEBUG, exception, null, supplier, (Object[]) null); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugExceptionWithMessageAndArguments() { Exception exception = new NullPointerException(); Logger.debug(exception, "Hello {}!", "World"); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(AdvancedMessageFormatter.class), eq("Hello {}!"), eq("World")); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }
@Test public void debugExceptionWithMessageAndLazyArguments() { Exception exception = new NullPointerException(); Supplier<Integer> supplier = mockSupplier(42); Logger.debug(exception, "The number is {}", supplier); verify(supplier, never()).get(); if (debugEnabled) { verify(provider).log(eq(2), isNull(), eq(Level.DEBUG), same(exception), any(AdvancedMessageFormatter.class), eq("The number is {}"), eq(supplier)); } else { verify(provider, never()).log(anyInt(), anyString(), any(), any(), any(), any(), any()); } }