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