#605 Add custom log levels, create debug logging method

- Log levels in the log file too
- Create migration from old boolean "stop spam" property to new log level property
This commit is contained in:
ljacqu
2016-07-22 17:45:00 +02:00
parent 0eb1890cf9
commit a8df8ceb09
14 changed files with 218 additions and 88 deletions
@@ -0,0 +1,31 @@
package fr.xephi.authme.output;
import org.junit.Test;
import static java.lang.String.format;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
/**
* Test for {@link LogLevel}.
*/
public class LogLevelTest {
@Test
public void shouldIncludeProperLevels() {
checkLevelInclusion(LogLevel.INFO, true, false, false);
checkLevelInclusion(LogLevel.FINE, true, true, false);
checkLevelInclusion(LogLevel.DEBUG, true, true, true);
}
private void checkLevelInclusion(LogLevel level, boolean... expectedValues) {
LogLevel[] levels = LogLevel.values();
assertThat("Number of expected values corresponds to number of log levels",
expectedValues.length, equalTo(levels.length));
for (int i = 0; i < levels.length; ++i) {
assertThat(format("%s.includes(%s) should be %b", level, levels[i], expectedValues[i]),
level.includes(levels[i]), equalTo(expectedValues[i]));
}
}
}