All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.cola.logger.LoggerFactory Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
package com.alibaba.cola.logger;

public class LoggerFactory {

    private static boolean useSysLogger = false;

    public static Logger getLogger(Class clazz) {
        if(useSysLogger)
            return SysLogger.getLogger(clazz);
        org.slf4j.Logger slfjLogger = org.slf4j.LoggerFactory.getLogger(clazz);
        return new SLFJLogger(slfjLogger);
    }

    public static Logger getLogger(String loggerName) {
        if(useSysLogger) {
            return SysLogger.getLogger(loggerName);
        }
        org.slf4j.Logger slfjLogger = org.slf4j.LoggerFactory.getLogger(loggerName);
        return new SLFJLogger(slfjLogger);
    }

    /**
     * This is just for testing purpose, don't use it on product!
     */
    public static void activateSysLogger() {
        useSysLogger = true;
    }

    public static void deactivateSysLogger() {
        useSysLogger = false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy