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

com.j256.simplemagic.logger.backend.NullLogBackend Maven / Gradle / Ivy

Go to download

Simple Magic number package which allows content-type (mime-type) determination from files and byte arrays.

The newest version!
package com.j256.simplemagic.logger.backend;

import com.j256.simplemagic.logger.Level;
import com.j256.simplemagic.logger.LogBackend;
import com.j256.simplemagic.logger.LogBackendFactory;
import com.j256.simplemagic.logger.LoggerFactory;

/**
 * Log backend that ignores all log requests.
 * 
 * From SimpleLogging: https://github.com/j256/simplelogging
 *
 * @author graywatson
 */
public class NullLogBackend implements LogBackend {

	public NullLogBackend() {
		// no-op
	}

	@Override
	public boolean isLevelEnabled(Level level) {
		// never enabled
		return false;
	}

	@Override
	public void log(Level level, String msg) {
		// no-op
	}

	@Override
	public void log(Level level, String msg, Throwable throwable) {
		// no-op
	}

	/**
	 * Factory for generating NullLogBackend instances. This can be used with the
	 * {@link LoggerFactory#setLogBackendFactory(LogBackendFactory)} method to completely disable all logging.
	 */
	public static class NullLogBackendFactory implements LogBackendFactory {

		private static final NullLogBackend singleton = new NullLogBackend();

		@Override
		public LogBackend createLogBackend(String classLabel) {
			return singleton;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy