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 011/** 012 * As the name indicates, this {#link SLF4JServiceProvider} implementation git sdiscards all events. 013 * 014 * @author Ceki Gülcü 015 */ 016public class NOPServiceProvider implements SLF4JServiceProvider { 017 018 /** 019 * Declare the version of the SLF4J API this implementation is compiled against. 020 * The value of this field is modified with each major release. 021 */ 022 // to avoid constant folding by the compiler, this field must *not* be final 023 public static String REQUESTED_API_VERSION = "2.0.99"; // !final 024 025 private final ILoggerFactory loggerFactory = new NOPLoggerFactory(); 026 private final IMarkerFactory markerFactory = new BasicMarkerFactory(); 027 private final MDCAdapter mdcAdapter = new NOPMDCAdapter(); 028 029 public ILoggerFactory getLoggerFactory() { 030 return loggerFactory; 031 } 032 033 public IMarkerFactory getMarkerFactory() { 034 return markerFactory; 035 } 036 037 public MDCAdapter getMDCAdapter() { 038 return mdcAdapter; 039 } 040 041 @Override 042 public String getRequestedApiVersion() { 043 return REQUESTED_API_VERSION; 044 } 045 046 public void initialize() { 047 048 } 049 050 051}