package com.nmgs.util;

import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class LogUtils {
    public static final String LOG_APP_USER = "AppUser";
    public static final String LOG_APP_DEBUG = "AppDebug";
    public static final String LOG_SECURITY = "Sec";
    public static final String LOG_DATA = "Data";
    public static final String SQL_MSG = "SqlMsg";

    public static Logger getAppLog() {
        Logger log = LogManager.getLogger("AppUser");
        return log;
    }

    public static Logger getAppDebugLog() {
        Logger log = LogManager.getLogger("AppDebug");
        return log;
    }

    public static Logger getSecLog() {
        Logger log = LogManager.getLogger("Sec");
        return log;
    }

    public static Logger getDataLog() {
        Logger log = LogManager.getLogger("Data");
        return log;
    }

    public static Logger getSqlLog() {
        Logger log = LogManager.getLogger("SqlMsg");
        return log;
    }

    public static Logger getLog(String moduleName) {
        Logger log = LogManager.getLogger(moduleName);
        return log;
    }

    public static String filterLogForging(String str) {
        List<String> sensitiveStr = new ArrayList();
        sensitiveStr.add("%0d");
        sensitiveStr.add("%0a");
        sensitiveStr.add("%0A");
        sensitiveStr.add("%0D");
        sensitiveStr.add("\r");
        sensitiveStr.add("\n");
        String normalize = Normalizer.normalize(str, Normalizer.Form.NFKC);
        Iterator<String> iterator = sensitiveStr.iterator();
        while (iterator.hasNext()) {
            normalize.replace((CharSequence) iterator.next(), "");
        }
        return normalize;
    }
}
