"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.privateLogger = void 0;
const winston_1 = __importDefault(require("winston"));
const apiTransport_1 = require("./transports/apiTransport");
const billingConfig = {
    apiUrl: process.env.BILLING_LOG_API_URL || 'https://billing.getthespiderman.com/api/trusys/logs',
    batchSize: Number.parseInt(process.env.BILLING_LOG_BATCH_SIZE || '1000'),
    flushInterval: Number.parseInt(process.env.BILLING_LOG_FLUSH_INTERVAL || '10000'), // 2 minutes in ms
    maxRetries: Number.parseInt(process.env.BILLING_LOG_MAX_RETRIES || '7'), // 5-10 retries
    emailConfig: {
        url: process.env.BILLING_LOG_EMAIL_URL || '',
        fromEmail: process.env.BILLING_LOG_FROM_EMAIL || '',
        toEmail: process.env.BILLING_LOG_TO_EMAIL || '',
    }
};
// Private logger configuration
const privateLogger = winston_1.default.createLogger({
    level: process.env.PRIVATE_LOG_LEVEL || 'info',
    format: winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.errors({ stack: true }), winston_1.default.format.json()),
    transports: [
        // Console transport for development
        new winston_1.default.transports.Console({
            format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple())
        }),
        ...(billingConfig.apiUrl ? [new apiTransport_1.ApiTransport({
                apiUrl: billingConfig.apiUrl,
                batchSize: billingConfig.batchSize,
                flushInterval: billingConfig.flushInterval,
                maxRetries: billingConfig.maxRetries,
                emailConfig: billingConfig.emailConfig,
            })] : [])
    ]
});
exports.privateLogger = privateLogger;
exports.default = privateLogger;
//# sourceMappingURL=privateLogger.js.map