xref: /aosp_15_r20/external/slf4j/slf4j-simple/src/main/java/org/slf4j/simple/SimpleServiceProvider.java (revision d4cc4a21ff30dee54251e974d02850809c70b030)
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 
getLoggerFactory()23     public ILoggerFactory getLoggerFactory() {
24         return loggerFactory;
25     }
26 
27     @Override
getMarkerFactory()28     public IMarkerFactory getMarkerFactory() {
29         return markerFactory;
30     }
31 
32     @Override
getMDCAdapter()33     public MDCAdapter getMDCAdapter() {
34         return mdcAdapter;
35     }
36 
37     @Override
getRequestedApiVersion()38     public String getRequestedApiVersion() {
39         return REQUESTED_API_VERSION;
40     }
41 
42     @Override
initialize()43     public void initialize() {
44 
45         loggerFactory = new SimpleLoggerFactory();
46         markerFactory = new BasicMarkerFactory();
47         mdcAdapter = new NOPMDCAdapter();
48     }
49 
50 }
51