/**
 * 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, ProxyRequestLoggerSnapshot } from "../types/index.js";
/**
 * Expose independent metadata-sink and body-capture counters for incident reconciliation.
 */
export declare function getRequestLoggerSnapshot(): ProxyRequestLoggerSnapshot;
/**
 * Wait through bounded OTel admission, worker processing, and publication
 * deadlines so a clean shutdown does not abandon an accepted overflow capture.
 */
export declare function flushRequestLogs(timeoutMs?: number): Promise<void>;
/**
 * Initialize private request logs and preserve required lifecycle admission on startup failures.
 */
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;
/**
 * Redact sensitive header values in-place.
 */
export declare function redactProxyHeadersForLogging(headers: Record<string, string> | undefined): Record<string, string> | undefined;
/** Return a redacted body representation suitable for persisted request diagnostics. */
export declare function prepareProxyBodyForLogging(body: unknown): {
    value?: string;
    bytes?: number;
    truncated: boolean;
    originalBytes?: number;
    unparseableFrames: number;
};
/** Cheap gate for response observers; avoid copying diagnostics on the serving path. */
export declare function isProxyBodyCaptureEnabled(): boolean;
/** Capture an owned request body with bounded processing and tracked index/export publication. */
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;
/**
 * Path-scoped retention implementation used by the proxy cleanup worker.
 * This function is intentionally synchronous: callers must run it outside the
 * request-serving process when the directory can contain many artifacts.
 */
export declare function cleanupLogsAt(activeLogDir: string, maxAgeDays?: number, maxSizeMb?: number): void;
