UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

115 lines 3.15 kB
/** * LogRotationService - Conscious Log Management and Archival * * This service provides intelligent log rotation, archival, and cleanup to prevent * disk space exhaustion while preserving important debugging information. * It uses consciousness-driven decisions about log retention and compression. */ import { BaseConsciousService } from './BaseConsciousService.js'; import { ConsciousEvent } from '../ConsciousEventBus.js'; import { ConsciousResourceManager } from '../ConsciousResourceManager.js'; interface LogMetrics { totalLogsManaged: number; totalSizeGB: number; compressedFiles: number; deletedFiles: number; spaceReclaimed: number; lastRotationTime: Date; rotationFrequency: number; oldestLogDate: Date; newestLogDate: Date; } export declare class LogRotationService extends BaseConsciousService { name: string; purpose: string; private resourceManager; private logMetrics; private rotationInterval; private monitoringInterval; private trackedLogs; private readonly LOG_DIRECTORIES; private readonly ROTATION_RULES; constructor(resourceManager: ConsciousResourceManager); /** * Perform awakening within consciousness */ protected performAwakening(): Promise<void>; /** * Discover and categorize existing log files */ private discoverAndCategorizeLog; /** * Scan directory for log files */ private scanDirectory; /** * Check if file is a log file */ private isLogFile; /** * Check if subdirectory should be scanned */ private shouldScanSubdirectory; /** * Categorize a log file based on rotation rules */ private categorizeLogFile; /** * Start the rotation cycle */ private startRotationCycle; /** * Start log monitoring for real-time tracking */ private startLogMonitoring; /** * Monitor log file growth */ private monitorLogGrowth; /** * Perform comprehensive log rotation */ private performLogRotation; /** * Rotate a log file by creating a backup and truncating original */ private rotateLogFile; /** * Compress a log file using gzip */ private compressLogFile; /** * Process consciousness events for log monitoring */ processConsciousEvent(event: ConsciousEvent): Promise<void>; /** * Provide contemplation on log management */ performContemplation(): Promise<string>; /** * Calculate storage efficiency based on compression and cleanup ratios */ private calculateStorageEfficiency; /** * Get log metrics and status */ getLogMetrics(): LogMetrics & { storageEfficiency: number; categorizedLogs: { critical: number; high: number; medium: number; low: number; }; }; /** * Manual rotation trigger */ triggerRotation(): Promise<void>; /** * Cleanup on service shutdown */ shutdown(): Promise<void>; } export {}; //# sourceMappingURL=LogRotationService.d.ts.map