com.softicar.platform.common.core.logging.CurrentLogLevel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.logging;
import com.softicar.platform.common.core.singleton.Singleton;
/**
* This is a {@link Singleton} to hold the currently selected {@link LogLevel}.
*
* It is primarily used by the class {@link Log} to control the desired amount
* of logging messages.
*
* @author Oliver Richers
*/
public class CurrentLogLevel {
private static final Singleton LOG_LEVEL = new Singleton<>(() -> LogLevel.INFO).setInheritByIdentity();
/**
* Returns the currently used log level.
*
* @return the current log level, never null
*/
public static LogLevel get() {
return LOG_LEVEL.get();
}
/**
* Sets the new log level to use.
*/
public static void set(LogLevel logLevel) {
LOG_LEVEL.set(logLevel);
}
/**
* Resets the current log level to default.
*/
public static void reset() {
set(null);
}
}