001package org.slf4j.helpers; 002 003import org.slf4j.ILoggerFactory; 004import org.slf4j.IMarkerFactory; 005import org.slf4j.spi.MDCAdapter; 006import org.slf4j.spi.SLF4JServiceProvider; 007 008public class SubstituteServiceProvider implements SLF4JServiceProvider { 009 private final SubstituteLoggerFactory loggerFactory = new SubstituteLoggerFactory(); 010 011 // LoggerFactory expects providers to initialize markerFactory as early as possible. 012 private final IMarkerFactory markerFactory; 013 014 // LoggerFactory expects providers to initialize their MDCAdapter field 015 // as early as possible, preferably at construction time. 016 private final MDCAdapter mdcAdapter; 017 018 public SubstituteServiceProvider() { 019 markerFactory = new BasicMarkerFactory(); 020 mdcAdapter = new BasicMDCAdapter(); 021 } 022 023 @Override 024 public ILoggerFactory getLoggerFactory() { 025 return loggerFactory; 026 } 027 028 public SubstituteLoggerFactory getSubstituteLoggerFactory() { 029 return loggerFactory; 030 } 031 032 @Override 033 public IMarkerFactory getMarkerFactory() { 034 return markerFactory; 035 } 036 037 @Override 038 public MDCAdapter getMDCAdapter() { 039 return mdcAdapter; 040 } 041 042 @Override 043 public String getRequestedApiVersion() { 044 throw new UnsupportedOperationException(); 045 } 046 047 @Override 048 public void initialize() { 049 } 050}