Add default logger level in factory

This commit is contained in:
Gabriel Tofvesson 2021-04-23 20:07:41 +02:00
parent d8570dd6a9
commit b7fa0c8273

View File

@ -1,13 +1,26 @@
package dev.w1zzrd.logging;
import java.util.logging.Level;
import java.util.logging.Logger;
public class LoggerFactory {
public static Logger getLogger(Class<?> cls) {
return Logger.getLogger(cls.getName());
public static Logger getLogger(final Class<?> cls) {
return getLogger(cls, Level.ALL);
}
public static Logger getLogger(String name) {
return Logger.getLogger(name);
public static Logger getLogger(final Class<?> cls, final Level level) {
final Logger l = Logger.getLogger(cls.getName());
l.setLevel(level);
return l;
}
public static Logger getLogger(final String name) {
return getLogger(name, Level.ALL);
}
public static Logger getLogger(final String name, final Level level) {
final Logger l = Logger.getLogger(name);
l.setLevel(level);
return l;
}
}