// Path: logger-slf4j/src/main/java/net/openhft/chronicle/logger/slf4j/ChronicleLoggerFactory.java
// public class ChronicleLoggerFactory implements ILoggerFactory {
//     private final Map<String, Logger> loggers;
//     private final ChronicleLogManager manager;
// 
//     // *************************************************************************
//     //
//     // *************************************************************************
// 
//     /**
//      * c-tor
//      */
//     public ChronicleLoggerFactory() {
//         this.loggers = new ConcurrentHashMap<>();
//         this.manager = ChronicleLogManager.getInstance();
//     }
// 
//     // *************************************************************************
//     // for testing
//     // *************************************************************************
// 
//     /**
//      * Return an appropriate {@link ChronicleLogger} instance by name.
//      */
//     @Override
//     public Logger getLogger(String name) {
//         try {
//             return doGetLogger(name);
//         } catch (Exception e) {
//             System.err.println("Unable to initialize chronicle-logger-slf4j (" + name + ")\n  " + e.getMessage());
//             e.printStackTrace();
//         }
// 
//         return NOPLogger.NOP_LOGGER;
//     }
// 
//     // *************************************************************************
//     //
//     // *************************************************************************
// 
//     synchronized void reload() {
//         this.loggers.clear();
//         this.manager.reload();
//     }
// 
//     private synchronized Logger doGetLogger(String name) {
//         Logger logger = loggers.get(name);
//         if (logger == null) {
//             if (name != null && name.startsWith("net.openhft")) {
//                 SimpleLogger.lazyInit();
//                 logger = new SimpleLogger(name);
//             } else {
//                 final ChronicleLogWriter writer = manager.getWriter(name);
//                 logger = new ChronicleLogger(writer, name, manager.cfg().getLevel(name));
//             }
//             loggers.put(name, logger);
//         }
// 
//         return logger;
//     }
// }


import net.openhft.chronicle.logger.slf4j.ChronicleLoggerFactory;
import org.slf4j.ILoggerFactory;
import org.slf4j.spi.LoggerFactoryBinder;
/*
 * Copyright 2014-2020 chronicle.software
 *
 * http://www.chronicle.software
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.slf4j.impl;


public class StaticLoggerBinder implements LoggerFactoryBinder {

    private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
// Path: logger-slf4j/src/main/java/net/openhft/chronicle/logger/slf4j/ChronicleLoggerFactory.java
// public class ChronicleLoggerFactory implements ILoggerFactory {
//     private final Map<String, Logger> loggers;
//     private final ChronicleLogManager manager;
// 
//     // *************************************************************************
//     //
//     // *************************************************************************
// 
//     /**
//      * c-tor
//      */
//     public ChronicleLoggerFactory() {
//         this.loggers = new ConcurrentHashMap<>();
//         this.manager = ChronicleLogManager.getInstance();
//     }
// 
//     // *************************************************************************
//     // for testing
//     // *************************************************************************
// 
//     /**
//      * Return an appropriate {@link ChronicleLogger} instance by name.
//      */
//     @Override
//     public Logger getLogger(String name) {
//         try {
//             return doGetLogger(name);
//         } catch (Exception e) {
//             System.err.println("Unable to initialize chronicle-logger-slf4j (" + name + ")\n  " + e.getMessage());
//             e.printStackTrace();
//         }
// 
//         return NOPLogger.NOP_LOGGER;
//     }
// 
//     // *************************************************************************
//     //
//     // *************************************************************************
// 
//     synchronized void reload() {
//         this.loggers.clear();
//         this.manager.reload();
//     }
// 
//     private synchronized Logger doGetLogger(String name) {
//         Logger logger = loggers.get(name);
//         if (logger == null) {
//             if (name != null && name.startsWith("net.openhft")) {
//                 SimpleLogger.lazyInit();
//                 logger = new SimpleLogger(name);
//             } else {
//                 final ChronicleLogWriter writer = manager.getWriter(name);
//                 logger = new ChronicleLogger(writer, name, manager.cfg().getLevel(name));
//             }
//             loggers.put(name, logger);
//         }
// 
//         return logger;
//     }
// }


// Path: logger-slf4j/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
import net.openhft.chronicle.logger.slf4j.ChronicleLoggerFactory;
import org.slf4j.ILoggerFactory;
import org.slf4j.spi.LoggerFactoryBinder;

/*
 * Copyright 2014-2020 chronicle.software
 *
 * http://www.chronicle.software
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.slf4j.impl;


public class StaticLoggerBinder implements LoggerFactoryBinder {

    private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
    private static final String loggerFactoryClassStr = ChronicleLoggerFactory.class.getName();