package pl.tehac.common.log;

import pl.tehac.common.log.impl.TehacLoggerImpl;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @author Artur Janeczko
 */
public class TehacLoggerFactory {

    private static final Map<String, TehacLogger> INITIALIZED_TEHAC_LOGGERS = new HashMap<>();

    public static TehacLogger getLogger(final Class<?> location) {

        final String className = location.getName();
        TehacLogger tehacLogger = INITIALIZED_TEHAC_LOGGERS.get(className);
        if (Objects.isNull(tehacLogger)) {
            tehacLogger = new TehacLoggerImpl(location);
            INITIALIZED_TEHAC_LOGGERS.put(className, tehacLogger);
        }
        return tehacLogger;
    }

}
