/**
 * Structured logging utilities
 */
import pino from 'pino';
import { getEnv } from './env';
/**
 * Create a Pino logger instance
 */
export function createLogger(serviceName) {
    const env = getEnv();
    const isDevelopment = env.NODE_ENV === 'development';
    return pino({
        level: env.LOG_LEVEL,
        name: serviceName,
        transport: isDevelopment
            ? {
                target: 'pino-pretty',
                options: {
                    colorize: true,
                    translateTime: 'HH:MM:ss Z',
                    ignore: 'pid,hostname',
                },
            }
            : undefined,
        formatters: {
            level: (label) => {
                return { level: label };
            },
        },
        timestamp: pino.stdTimeFunctions.isoTime,
    });
}
/**
 * Add correlation ID to logger context
 */
export function withCorrelationId(logger, correlationId) {
    return logger.child({ correlationId });
}
//# sourceMappingURL=logger.js.map