View Javadoc
1   package org.slf4j.simple;
2   
3   import org.slf4j.ILoggerFactory;
4   import org.slf4j.IMarkerFactory;
5   import org.slf4j.helpers.BasicMarkerFactory;
6   import org.slf4j.helpers.NOPMDCAdapter;
7   import org.slf4j.spi.MDCAdapter;
8   import org.slf4j.spi.SLF4JServiceProvider;
9   
10  public class SimpleServiceProvider implements SLF4JServiceProvider {
11  
12      /**
13       * Declare the version of the SLF4J API this implementation is compiled against. 
14       * The value of this field is modified with each major release. 
15       */
16      // to avoid constant folding by the compiler, this field must *not* be final
17      public static String REQUESTED_API_VERSION = "2.0.99"; // !final
18  
19      private ILoggerFactory loggerFactory;
20      private IMarkerFactory markerFactory;
21      private MDCAdapter mdcAdapter;
22  
23      public ILoggerFactory getLoggerFactory() {
24          return loggerFactory;
25      }
26  
27      @Override
28      public IMarkerFactory getMarkerFactory() {
29          return markerFactory;
30      }
31  
32      @Override
33      public MDCAdapter getMDCAdapter() {
34          return mdcAdapter;
35      }
36  
37      @Override
38      public String getRequestedApiVersion() {
39          return REQUESTED_API_VERSION;
40      }
41  
42      @Override
43      public void initialize() {
44  
45          loggerFactory = new SimpleLoggerFactory();
46          markerFactory = new BasicMarkerFactory();
47          mdcAdapter = new NOPMDCAdapter();
48      }
49  
50  }