package instep.springboot;

import instep.Instep;
import instep.InstepLogger;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * auto configuration for instep.core module.
 */
@Configuration
public class CoreAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public Instep instep(InstepLogger instepLogger) {
        Instep.INSTANCE.bind(InstepLogger.class, instepLogger, "");
        InstepLogger.Companion.setLogger(instepLogger);

        return Instep.INSTANCE;
    }

    @SuppressWarnings("NullableProblems")
    @Bean
    @ConditionalOnMissingBean
    public InstepLogger instepLogger() {
        return new InstepLogger() {
            @Override
            public boolean getEnableDebug() {
                return true;
            }

            @Override
            public boolean getEnableInfo() {
                return true;
            }

            @Override
            public boolean getEnableWarning() {
                return true;
            }

            @Override
            public void debug(String s, String s1) {
                LogFactory.getLog(s1).debug(s);
            }

            @Override
            public void info(String s, String s1) {
                LogFactory.getLog(s1).info(s);
            }

            @Override
            public void warning(String s, String s1) {
                LogFactory.getLog(s1).warn(s);
            }

            @Override
            public void debug(String s, Class<?> aClass) {
                debug(s, aClass.getName());
            }

            @Override
            public void info(String s, Class<?> aClass) {
                info(s, aClass.getName());
            }

            @Override
            public void warning(String s, Class<?> aClass) {
                warning(s, aClass.getName());
            }
        };
    }
}

@@ -71,16 +71,55 @@
 Logger;%0A
+import org.apache.commons.logging.Log;%0A
 import o
@@ -352,16 +352,86 @@
 ation;%0A%0A
+import java.util.Map;%0Aimport java.util.concurrent.ConcurrentHashMap;%0A%0A
 /**%0A * a
@@ -901,32 +901,105 @@
 nstepLogger() %7B%0A
+        final Map%3CString, Log%3E loggerCache = new ConcurrentHashMap%3C%3E();%0A%0A
         return n
@@ -1453,309 +1453,669 @@
  Log
-Factory.getLog(s1).debug(s);%0A            %7D%0A%0A            @Override%0A            public void info(String s, String s1) %7B%0A                LogFactory.getLog(s1).info(s);%0A            %7D%0A%0A            @Override%0A            public void warning(String s, String s1) %7B%0A                LogFactory.getLog(s1).warn(s
+ logger = loggerCache.getOrDefault(s1, LogFactory.getLog(s1));%0A                logger.debug(s);%0A                loggerCache.putIfAbsent(s1, logger);%0A            %7D%0A%0A            @Override%0A            public void info(String s, String s1) %7B%0A                Log logger = loggerCache.getOrDefault(s1, LogFactory.getLog(s1));%0A                logger.info(s);%0A                loggerCache.putIfAbsent(s1, logger);%0A            %7D%0A%0A            @Override%0A            public void warning(String s, String s1) %7B%0A                Log logger = loggerCache.getOrDefault(s1, LogFactory.getLog(s1));%0A                logger.warn(s);%0A                loggerCache.putIfAbsent(s1, logger
 );%0A 

improve InstepLogger for spring boot.