import type { Auth } from './auth.js'; /** * Platform logger -- captures errors, SDK API calls, and custom events. * * Three storage layers: * 1. In-memory ring buffer (last 200 entries, always available) * 2. localStorage (last 500 entries, survives page refresh) * 3. Server-side (batched upload to /v1/apps/:appId/logs, survives everything) * * Automatic captures: * - Uncaught errors (window.onerror) * - Unhandled promise rejections * - SDK API call results (proxy, kv, collections, etc.) * - Network failures * * Manual: fas.log.info/warn/error/debug(message, data?) */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; export interface LogEntry { ts: number; level: LogLevel; category: string; message: string; data?: unknown; /** Build metadata, attached to first entry of each session */ build?: BuildMeta; } export interface BuildMeta { appVersion?: string | undefined; commitSha?: string | undefined; buildDate?: string | undefined; sdkVersion: string; userAgent: string; url: string; viewport: string; theme?: string | undefined; } export declare const SDK_VERSION = "0.14.24"; export declare class Logger { private readonly appId; private readonly apiBase; private readonly auth; private buffer; private uploadTimer; private sessionLogged; private uploadedThrough; private evicted; constructor(appId: string, apiBase: string, auth: Auth); debug(message: string, data?: unknown): void; info(message: string, data?: unknown): void; warn(message: string, data?: unknown): void; error(message: string, data?: unknown): void; /** Get all in-memory log entries (newest first). */ entries(): LogEntry[]; /** Dump all logs as a formatted string (for console or clipboard). */ dump(): string; /** Clear all logs (memory + localStorage). */ clear(): void; /** Force upload pending logs to server now. */ flush(): Promise; /** Get build metadata for the current session. */ getBuildMeta(): BuildMeta; /** @internal Log an SDK API call result. */ _api(method: string, path: string, status: number, durationMs: number, error?: string): void; private add; private installGlobalHandlers; private saveToStorage; private loadFromStorage; private startUploadTimer; private uploadBatch; private uploading; private doUploadBatch; destroy(): void; } //# sourceMappingURL=logger.d.ts.map