All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.logging.CurrentLogOuput Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
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();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy