TinylogLoggingConfiguration { public static LogEntry createLogEntry(final StackTraceElement stackTraceElement, final String tag, final Level level, final Throwable exception, final MessageFormatter formatter, final Object obj, final Object[] arguments, final Collection<LogEntryValue>[] requiredLogEntryValues, final TinylogContextProvider contextProvider) { Collection<LogEntryValue> required = requiredLogEntryValues[level.ordinal()]; Timestamp timestamp = RuntimeProvider.createTimestamp(); Thread thread = required.contains(LogEntryValue.THREAD) ? Thread.currentThread() : null; Map<String, String> context = required.contains(LogEntryValue.CONTEXT) ? contextProvider.getMapping() : null; String className; String methodName; String fileName; int lineNumber; if (stackTraceElement == null) { className = null; methodName = null; fileName = null; lineNumber = -1; } else { className = stackTraceElement.getClassName(); methodName = stackTraceElement.getMethodName(); fileName = stackTraceElement.getFileName(); lineNumber = stackTraceElement.getLineNumber(); } String message; if (arguments == null || arguments.length == 0) { Object evaluatedObject = obj instanceof Supplier<?> ? ((Supplier<?>) obj).get() : obj; message = evaluatedObject == null ? null : evaluatedObject.toString(); } else { message = formatter.format((String) obj, arguments); } return new LogEntry(timestamp, thread, context, className, methodName, fileName, lineNumber, tag, level, message, exception); } TinylogLoggingConfiguration(); @SuppressWarnings("unchecked") Collection<Writer>[][] createWriters(final List<String> tags, final Level minimumLevel, final boolean writingThread); Level calculateMinimumLevel(final Level globalLevel, final Map<String, Level> customLevels); @SuppressWarnings("unchecked") Collection<LogEntryValue>[][] calculateRequiredLogEntryValues(final Collection<Writer>[][] writers); BitSet calculateFullStackTraceRequirements(final Collection<LogEntryValue>[][] logEntryValues); WritingThread createWritingThread(final Collection<Writer>[][] matrix); static Collection<Writer> getAllWriters(final Collection<Writer>[][] matrix); static LogEntry createLogEntry(final StackTraceElement stackTraceElement, final String tag, 
		final Level level, final Throwable exception, final MessageFormatter formatter, final Object obj,
		final Object[] arguments, final Collection<LogEntryValue>[] requiredLogEntryValues, 
		final TinylogContextProvider contextProvider);  }
@Test @SuppressWarnings("unchecked") public void createLogEntry() { TinylogContextProvider contextProvider = new TinylogContextProvider(); contextProvider.put("id", "100"); Collection<LogEntryValue>[] requiredLogEntryValues = new Collection[Level.values().length - 1]; requiredLogEntryValues[Level.INFO.ordinal()] = Arrays.asList(new LogEntryValue[] {LogEntryValue.TAG, LogEntryValue.LEVEL}); LogEntry entry1 = TinylogLoggingConfiguration.createLogEntry(null, "testtag", Level.INFO, null, null, null, null, requiredLogEntryValues, null); assertThat(entry1.getTag()).isEqualTo("testtag"); assertThat(entry1.getLevel()).isEqualTo(Level.INFO); requiredLogEntryValues[Level.INFO.ordinal()] = Arrays.asList(new LogEntryValue[] {LogEntryValue.CONTEXT}); LogEntry entry2 = TinylogLoggingConfiguration.createLogEntry(null, null, Level.INFO, null, null, null, null, requiredLogEntryValues, contextProvider); assertThat(entry2.getContext()).containsAllEntriesOf(Collections.singletonMap("id", "100")); requiredLogEntryValues[Level.INFO.ordinal()] = Arrays.asList(new LogEntryValue[] {LogEntryValue.EXCEPTION}); LogEntry entry3 = TinylogLoggingConfiguration.createLogEntry(null, null, Level.INFO, new Exception("test"), null, null, null, requiredLogEntryValues, null); assertThat(entry3.getException().getMessage()).isEqualTo("test"); }