interface BatchLoggerConfig { /** 用户ID */ userId: string; /** 租户ID */ tenantId: string; /** 应用ID */ appId: string; /** 后端接收日志的接口地址,默认为/dev/logs/collect */ endpoint?: string; /** 达到此数量时触发刷新 */ sizeThreshold?: number; /** 自动刷新的时间间隔(毫秒) */ flushInterval?: number; /** 最大重试次数 */ maxRetries?: number; /** 重试延迟(毫秒) */ retryDelay?: number; /** 自定义请求头 */ headers?: Record; } export declare class BatchLogger { private config; private logQueue; private flushTimer; private isProcessing; private originConsole; constructor(console: Console, config?: BatchLoggerConfig); /** * 批量记录日志(对外暴露的唯一方法) */ batchLog(level: string, message: string, source?: string): void; /** * 刷新日志队列,全部发送 */ flush(): Promise; /** * 发送日志批次到后端 */ private sendBatch; /** * 执行实际的fetch请求 */ private execFetch; /** * 启动自动刷新定时器 */ private startFlushTimer; /** * 设置页面卸载时的处理 */ private setupBeforeUnloadHandler; /** * 延迟函数 */ private delay; /** * 生成唯一ID */ private generateId; /** * 销毁资源 */ destroy(): Promise; /** * 获取队列大小 */ getQueueSize(): number; /** * 更新配置 */ updateConfig(newConfig: Partial): void; } export declare function getBatchLogger(): BatchLogger; export declare function initBatchLogger(oldConsole: Console, config?: BatchLoggerConfig): void; /** 记录日志进行批量同步 */ export declare function batchLogInfo(level: string, message: string, source?: string): void; export declare function destroyBatchLogger(): void; export {};