export interface LogContext { requestId: string recordId: string step: string timestamp: string } export function createLogger(recordId: string) { const requestId = crypto.randomUUID() return { info: (step: string, message: string, data?: any) => { console.log(JSON.stringify({ level: 'info', requestId, recordId, step, message, data, timestamp: new Date().toISOString() })) }, error: (step: string, error: Error, data?: any) => { console.error(JSON.stringify({ level: 'error', requestId, recordId, step, message: error.message, stack: error.stack, data, timestamp: new Date().toISOString() })) } } }