package org.tinylog.core.test;

import java.util.ArrayList;
import java.util.List;

import org.tinylog.core.Level;

/**
 * Storage for {@link LogEntry LogEntries}.
 */
public class Log {

	private Level minLevel;
	private List<LogEntry> entries;

	/** */
	public Log() {
		minLevel = Level.INFO;
		entries = new ArrayList<>();
	}

	/**
	 * Gets the new minimum severity level. All log entries with a severity level less severe than the minimum level are
	 * ignored.
	 *
	 * @return The actual configured minimum severity level
	 */
	public Level getMinLevel() {
		return minLevel;
	}

	/**
	 * Sets a new minimum severity level. All log entries with a severity level less severe than the minimum level are
	 * ignored.
	 *
	 * @param level New minimum severity level
	 */
	public void setMinLevel(Level level) {
		this.minLevel = level;
	}

	/**
	 * Appends a new log entry to the end of this log.
	 *
	 * @param entry Log entry to append to this log
	 */
	public void add(LogEntry entry) {
		if (entry.getLevel().ordinal() <= minLevel.ordinal()) {
			entries.add(entry);
		}
	}

	/**
	 * Retrieves all stored log entries and clears the entire log afterwards.
	 *
	 * @return All store log entries
	 */
	public Iterable<LogEntry> consume() {
		try {
			return entries;
		} finally {
			entries = new ArrayList<>();
		}
	}

}

@@ -848,204 +848,199 @@
 %09 * 
-Appends a new log entry to the end of this log.%0A%09 *%0A%09 * @param entry Log entry to append to this log%0A%09 */%0A%09public void add(LogEntry en
+Retrieves all stored log entries and clears the entire log afterwards.%0A%09 *%0A%09 * @return All store log entries%0A%09 */%0A%09public Iterable%3CLogEntry%3E consume() %7B%0A%09%09
 try
-)
  %7B%0A%09%09
-if (entry.getLevel().ordinal() %3C= minLevel.ord
+%09return entries;%0A%09%09%7D f
 inal
-())
+ly
  %7B%0A%09
@@ -1052,18 +1052,27 @@
 ries
-.add(entry
+ = new ArrayList%3C%3E(
 );%0A%09
@@ -1091,199 +1091,197 @@
 %09 * 
-Retrieves all stored log entries and clears the entire log afterwards.%0A%09 *%0A%09 * @return All store log entries%0A%09 */%0A%09public Iterable%3CLogEntry%3E consume() %7B%0A%09%09
+Appends a new log entry to the end of this log.%0A%09 *%0A%09 * @param entry Log entry to append to this log%0A%09 */%0A%09void add(LogEntry en
 try
+)
  %7B%0A%09%09
-%09return entries;%0A%09%09%7D f
+if (entry.getLevel().ordinal() %3C= minLevel.ord
 inal
-ly
+())
  %7B%0A%09
@@ -1289,35 +1289,26 @@
 %09entries
- = new ArrayList%3C%3E(
+.add(entry
 );%0A%09%09%7D%0A%09

Declare add() method in log class as package private