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

com.dadrox.slf4j.QuietLoggerFactory Maven / Gradle / Ivy

The newest version!
package com.dadrox.slf4j;

import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class QuietLoggerFactory implements ILoggerFactory {

    ConcurrentMap loggers = new ConcurrentHashMap();

    @Override
    public Logger getLogger(String name) {
        Logger logger = loggers.get(name);
        if (logger != null) {
            return logger;
        }
        Logger newLogger = new QuietLogger(name);
        Logger oldLogger = loggers.putIfAbsent(name, newLogger);
        return oldLogger == null ? newLogger : oldLogger;
    }

    void reset() {
        loggers.clear();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy