"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const log4js_1 = require("log4js");
const os = require("os");
/**
 * Log4js 配置
 */
const log4js = log4js_1.getLogger();
exports.log4js = log4js;
log4js.level = 'debug';
const appName = process.env.KT_APP_NAME || 'debugger'; //从K8S环境变量中获取
const deploymentId = process.env.KT_K8S_DEPLOYMENT || 'deploymentId';
const podId = os.hostname() || 'podId';
const contextId = process.env.KT_CONTEXT || 'contextId';
const logPath = process.env.KT_LOG_PATH || '/opt/app/logs';
log4js_1.configure({
    appenders: {
        console: {
            encoding: "utf-8",
            type: 'stdout',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} %p ' + deploymentId + ' ' + podId + ' ' + contextId + ' %m%n'
            }
        },
        everything: {
            type: 'dateFile',
            encoding: "utf-8",
            filename: logPath + '/' + appName + '.log',
            pattern: '.yyyy-MM-dd',
            layout: {
                type: "pattern",
                pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} %p ' + deploymentId + ' ' + podId + ' ' + contextId + ' %m%n'
            },
            compress: true
        }
    },
    categories: {
        default: { appenders: ['console', 'everything'], level: 'debug' }
    }
});
