com.softicar.platform.common.core.logging.CurrentLogOuput 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;
import java.util.Objects;
/**
* This {@link Singleton} holds the current {@link ILogOutput} to be used by
* {@link Log}.
*
* @author Oliver Richers
*/
public class CurrentLogOuput {
private static final Singleton OUTPUT = new Singleton<>(() -> System.err::println);
/**
* Returns the currently used {@link ILogOutput}.
*
* @return the current {@link ILogOutput} (never null)
*/
public static ILogOutput get() {
return OUTPUT.get();
}
/**
* Sets the new {@link ILogOutput} to use.
*
* @param output
* the new {@link ILogOutput} to use (never null)
*/
public static void set(ILogOutput output) {
OUTPUT.set(Objects.requireNonNull(output));
}
/**
* Resets the output to default.
*/
public static void reset() {
OUTPUT.reset();
}
}