package com.engine.htsc.payment.log;

/**
 * 门户日志工厂类
 */
public class PaymentLoggerFactory {

    private static final String loggerName = "payment";

    public static PaymentLogger getLogger(String logName, String clazz) {
        if ("".equals(logName))
            logName = loggerName;
        PaymentLogger logger = new Log4JLogger();
        logger.setClassname(clazz);
        logger.init(logName);
        return logger;
    }

    /**
     * 获取指定类的logger对象
     *
     * @param clazz
     * @return
     */
    public static PaymentLogger getLogger(Class clazz) {
        return getLogger(loggerName, clazz.getCanonicalName());
    }

    /**
     * 获取指定类的logger对象
     *
     * @param className
     * @return
     */
    public static PaymentLogger getLogger(String className) {
        return getLogger(loggerName, className);
    }

    /**
     * 获取未指定指定类的logger对象
     *
     * @param
     * @return
     */
    public static PaymentLogger getLogger() {
        //获取当前调用类名
        String className = Thread.currentThread().getStackTrace()[2].getClassName();
        return getLogger(loggerName, className);
    }
}
