import pino from 'pino';
/**
 * Structured JSON logger for enterprise SIEM ingestion.
 * Always writes to stderr — stdout is reserved for MCP JSON-RPC in proxy mode.
 */
const level = process.env.LOG_LEVEL || 'info';
const logger = pino({
    level: level.toLowerCase(),
    formatters: {
        level(label) {
            return { level: label };
        },
    },
    timestamp: pino.stdTimeFunctions.isoTime,
}, pino.destination({ fd: 2, sync: false }));
export class StructuredLogger {
    static logPolicyDecision(entry) {
        logger.info(entry);
        import('./enterprise-bootstrap.js').then(({ exportSiemEvent }) => {
            exportSiemEvent('policy_decision', entry).catch(() => { });
        }).catch(() => { });
    }
    static logBlocked(entry) {
        logger.warn(entry);
        import('./enterprise-bootstrap.js').then(({ exportSiemEvent }) => {
            exportSiemEvent('tool_blocked', entry).catch(() => { });
        }).catch(() => { });
    }
    static logError(entry) {
        logger.error(entry);
    }
    static info(msg) {
        logger.info(msg);
    }
    static warn(msg) {
        logger.warn(msg);
    }
    static debug(msg) {
        logger.debug(msg);
    }
}
//# sourceMappingURL=structured-logger.js.map