/** * Convenience function for tracking async operations */ export function trackAsyncOperation(operationName: any, asyncFunction: any, context?: {}): Promise; /** * Convenience function for tracking sync operations */ export function trackSyncOperation(operationName: any, syncFunction: any, context?: {}): any; export namespace ErrorSeverity { let LOW: string; let MEDIUM: string; let HIGH: string; let CRITICAL: string; } export namespace PerformanceThresholds { export let FAST: number; export let NORMAL: number; export let SLOW: number; let CRITICAL_1: number; export { CRITICAL_1 as CRITICAL }; } /** * Enhanced Error Monitoring Class */ export class ErrorMonitor { constructor(options?: {}); enabled: boolean; logToFile: boolean; logDirectory: any; maxLogFiles: any; maxLogSize: any; performanceTracking: boolean; flushInterval: NodeJS.Timeout | null; metrics: { errors: Map; performance: Map; operations: Map; startTime: number; totalDuration: number; totalOperations: number; }; /** * Setup global error handlers for unhandled errors */ setupGlobalHandlers(): void; /** * Log an error with enhanced context */ logError(error: any, severity?: string, context?: {}): string | undefined; /** * Track operation performance */ startPerformanceTracking(operationName: any, context?: {}): { id: string; operation: any; startTime: number; context: {}; end: () => { id: any; timestamp: string; operation: any; duration: number; performanceLevel: string; context: any; } | undefined; } | null; /** * End performance tracking and log results */ endPerformanceTracking(trackingId: any, operationName: any, startTime: any, context: any): { id: any; timestamp: string; operation: any; duration: number; performanceLevel: string; context: any; } | undefined; /** * Categorize performance based on duration */ categorizePerformance(duration: any): "critical" | "fast" | "normal" | "slow"; /** * Get comprehensive metrics report */ getMetrics(): { uptime: { milliseconds: number; seconds: number; minutes: number; formatted: string; }; errors: { total: any; byType: any; critical: number; high: number; medium: number; low: number; }; performance: { total: any; byLevel: any; averageResponseTime: string | number; }; health: number; }; /** * Calculate health score based on error rates and performance */ calculateHealthScore(): number; /** * Flush metrics to file */ flushMetrics(): void; /** * Start periodic metrics flushing */ startPeriodicFlush(intervalMs?: number): void; /** * Stop periodic flushing */ stopPeriodicFlush(): void; /** * Helper methods */ generateId(): string; getErrorCountBySeverity(severity: any): number; getPerformanceCountByLevel(level: any): number; calculateAverageResponseTime(): number | "N/A - No operations tracked yet"; formatUptime(milliseconds: any): string; logToConsole(errorEntry: any): void; /** * Rotate log file if it exceeds max size */ rotateLogFile(logFile: any): void; /** * Clean up old log files */ cleanupOldLogs(daysToKeep?: number): void; logToFileSystem(errorEntry: any): void; logPerformanceToFile(performanceEntry: any): void; } /** * Global error monitor instance */ export const globalErrorMonitor: ErrorMonitor; export default ErrorMonitor;