import { Logger } from './Logger.js'; import { LogLevel, Verbosity, ILogHandler } from './types/index.js'; /** * Logger with export and remote capabilities * * @example * ```typescript * import { ExportLogger } from '@mks2508/better-logger/exports'; * * const logger = new ExportLogger({ bufferSize: 1000 }); * * // Log some data * logger.info('User logged in', { userId: 123 }); * logger.error('Failed to process', { error: 'timeout' }); * * // Export logs * const csvData = await logger.exportLogs('csv'); * const jsonData = await logger.exportLogs('json'); * * // Setup remote logging * logger.addRemoteHandler('https://api.myapp.com/logs', 'api-key'); * ``` */ export declare class ExportLogger extends Logger { private exportLogHandler?; private remoteHandlers; constructor(config?: { bufferSize?: number; } & any); /** * Export logs in specified format * * @param format - Export format (csv, json, xml) * @param options - Export options * @returns Promise resolving to exported data * * @example * ```typescript * const csvData = await logger.exportLogs('csv'); * const jsonData = await logger.exportLogs('json', { * filter: { level: 'error' }, * limit: 100 * }); * ``` */ exportLogs(format: 'csv' | 'json' | 'xml', options?: { filter?: { level?: LogLevel; from?: Date; to?: Date; }; limit?: number; }): Promise; /** * Get current log buffer * * @returns Array of log entries * * @example * ```typescript * const logs = logger.getLogs(); * console.log(`Buffered ${logs.length} log entries`); * ``` */ getLogs(): any[]; /** * Clear the log buffer * * @example * ```typescript * logger.clearLogs(); * ``` */ clearLogs(): void; /** * Get log statistics * * @returns Statistics object with counts by level * * @example * ```typescript * const stats = logger.getLogStats(); * console.log(`Errors: ${stats.error}, Warnings: ${stats.warn}`); * ``` */ getLogStats(): Record; /** * Add remote logging handler * * @param endpoint - Remote endpoint URL * @param apiKey - Optional API key for authentication * * @example * ```typescript * logger.addRemoteHandler('https://logs.myservice.com/api', 'secret-key'); * ``` */ addRemoteHandler(endpoint: string, apiKey?: string): void; /** * Remove all remote handlers * * @example * ```typescript * logger.clearRemoteHandlers(); * ``` */ clearRemoteHandlers(): void; /** * Flush all remote handlers (force send pending logs) * * @example * ```typescript * await logger.flushRemoteHandlers(); * ``` */ flushRemoteHandlers(): Promise; } declare const exportLogger: ExportLogger; /** * Export management utilities */ export declare const exportUtils: { /** * Export current logs as CSV */ exportCSV(options?: any): Promise; /** * Export current logs as JSON */ exportJSON(options?: any): Promise; /** * Export current logs as XML */ exportXML(options?: any): Promise; /** * Get log statistics */ getStats(): Record; /** * Clear all logs */ clear(): void; }; /** * Remote logging utilities */ export declare const remoteUtils: { /** * Add remote logging endpoint */ addEndpoint(url: string, apiKey?: string): void; /** * Clear all remote endpoints */ clearEndpoints(): void; /** * Flush all remote logs */ flush(): Promise; }; /** * Export individual logging methods with export capabilities */ export declare const debug: (...args: any[]) => void; export declare const info: (...args: any[]) => void; export declare const warn: (...args: any[]) => void; export declare const error: (...args: any[]) => void; export declare const success: (...args: any[]) => void; export declare const critical: (...args: any[]) => void; export declare const trace: (...args: any[]) => void; export declare const table: (data: any, columns?: string[]) => void; export declare const group: (label: string, collapsed?: boolean) => void; export declare const groupEnd: () => void; export declare const time: (label: string) => void; export declare const timeEnd: (label: string) => number; export declare const setGlobalPrefix: (prefix: string) => void; export declare const scope: (prefix: string) => import('./ScopedLogger.js').ScopedLogger; export declare const setVerbosity: (level: Verbosity) => void; export declare const addHandler: (handler: ILogHandler) => void; /** * Export functionality */ export declare const exportLogs: (format: "csv" | "json" | "xml", options?: any) => Promise; export declare const getLogs: () => any[]; export declare const clearLogs: () => void; export declare const getLogStats: () => Record; /** * Remote logging functionality */ export declare const addRemoteHandler: (endpoint: string, apiKey?: string) => void; export declare const clearRemoteHandlers: () => void; export declare const flushRemoteHandlers: () => Promise; export default exportLogger; export { ExportLogHandler, RemoteLogHandler } from './handlers/index.js'; export type { ILogHandler } from './types/index.js'; //# sourceMappingURL=exports-module.d.ts.map