UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

58 lines (57 loc) 2.32 kB
/** * Proxy Request Logger * Logs proxy request/response metadata to a rotating log file. * Also emits OTLP log records to OpenObserve (or any OTLP-compatible backend) * when a LoggerProvider is configured via OpenTelemetry instrumentation. * Useful for debugging and auditing proxy traffic. */ import type { ProxyBodyCaptureEntry, RequestAttemptLogEntry, RequestLogEntry } from "../types/index.js"; export declare function initRequestLogger(enabled?: boolean, customLogsDir?: string): void; export declare function logRequest(entry: RequestLogEntry): Promise<void>; /** * Log an upstream attempt separately from the final request outcome. * Attempt logs are local-only and must not pollute the final request summary * or OTLP-derived dashboard panels. */ export declare function logRequestAttempt(entry: RequestAttemptLogEntry): Promise<void>; export declare function getLogDir(): string | null; export declare function logBodyCapture(entry: ProxyBodyCaptureEntry): Promise<void>; /** * Log the FULL raw request and response for debugging. * Legacy helper kept for compatibility. New call sites should prefer * logBodyCapture() so each phase can be indexed and persisted separately. */ export declare function logFullRequestResponse(entry: { timestamp: string; requestId: string; account: string; model: string; stream: boolean; requestHeaders: Record<string, string>; requestBody: unknown; requestBodySize: number; responseStatus: number; responseHeaders?: Record<string, string>; responseBody?: string; responseBodySize?: number; durationMs: number; }): Promise<void>; /** * Log a mid-stream error that occurs after the initial 200 was sent. * These are invisible in normal request logs since the 200 was already recorded. */ export declare function logStreamError(entry: { timestamp: string; requestId: string; account: string; model: string; errorMessage: string; durationMs: number; }): Promise<void>; /** * Clean up old log files by age and total size. * - Deletes files older than maxAgeDays * - If remaining files exceed maxSizeMb, deletes oldest until under limit * Non-fatal — proxy keeps working even if cleanup fails. */ export declare function cleanupLogs(maxAgeDays?: number, maxSizeMb?: number): void;