001package org.slf4j.nop;
002
003import org.slf4j.ILoggerFactory;
004import org.slf4j.IMarkerFactory;
005import org.slf4j.helpers.BasicMarkerFactory;
006import org.slf4j.helpers.NOPLoggerFactory;
007import org.slf4j.helpers.NOPMDCAdapter;
008import org.slf4j.spi.MDCAdapter;
009import org.slf4j.spi.SLF4JServiceProvider;
010
011public class NOPServiceProvider implements SLF4JServiceProvider {
012
013    /**
014     * Declare the version of the SLF4J API this implementation is compiled against. 
015     * The value of this field is modified with each major release. 
016     */
017    // to avoid constant folding by the compiler, this field must *not* be final
018    public static String REQUESTED_API_VERSION = "2.0.99"; // !final
019
020    private final ILoggerFactory loggerFactory = new NOPLoggerFactory();
021
022    // LoggerFactory expects providers to initialize markerFactory as early as possible.
023    private final IMarkerFactory markerFactory;
024    
025    // LoggerFactory expects providers to initialize their MDCAdapter field
026    // as early as possible, preferably at construction time.
027    private final MDCAdapter mdcAdapter;
028
029    public NOPServiceProvider() {
030        markerFactory = new BasicMarkerFactory();
031        mdcAdapter = new NOPMDCAdapter();
032    }
033    public ILoggerFactory getLoggerFactory() {
034        return loggerFactory;
035    }
036
037    public IMarkerFactory getMarkerFactory() {
038        return markerFactory;
039    }
040
041    public MDCAdapter getMDCAdapter() {
042        return mdcAdapter;
043    }
044
045    @Override
046    public String getRequestedApiVersion() {
047        return REQUESTED_API_VERSION;
048    }
049
050    public void initialize() {
051    }
052
053   
054}