/** * Central coordinator for the Unified Logging System. * * Accepts UnifiedLogEntry objects from all sources, enforces level filtering * and entry size limits, routes entries to registered sinks, and manages * flush lifecycle (timer + buffer threshold + immediate flush for security). * * See docs/LOGGING-DESIGN.md ยง4.2 for the full design. */ import { type UnifiedLogEntry, type ILogSink, type LogManagerConfig } from './types.js'; export declare class LogManager { private readonly sinks; private readonly buffer; private readonly config; private flushTimer; private entryCounter; private dropCount; private previousBufferSize; private immediateFlushWindowStart; private immediateFlushCount; constructor(config: LogManagerConfig); /** * Route a log entry to all registered sinks. * * - Skips entries below the minimum log level. * - Enforces max entry size (truncates `data`, sets `_truncated`). * - Security warn/error entries trigger an immediate (rate-limited) flush. * - Other entries are buffered; a flush is triggered when the buffer is full. */ log(entry: UnifiedLogEntry): void; /** Register an output sink. */ registerSink(sink: ILogSink): void; /** Flush all registered sinks and report drops if any occurred. */ flush(): Promise; /** Graceful shutdown: clear timer, flush, then close all sinks. */ close(): Promise; /** * Generate a unique log entry ID. * Format: `LOG-{timestamp}-{counter}` */ generateId(): string; private startFlushTimer; private stopFlushTimer; /** * Sliding-window rate limiter for immediate flushes. * Returns `true` if an immediate flush is allowed right now. */ private canImmediateFlush; /** * Enforce `maxEntrySize` by truncating the `data` field if necessary. * Returns the original entry unmodified when under the limit, or a * shallow copy with `data` replaced when truncation is needed. */ private enforceEntrySize; /** Create a meta/system log entry from the LogManager itself. */ private createMetaEntry; } /** * Map the flat env object (from Zod-parsed `process.env`) to a typed * `LogManagerConfig`. Keeps the mapping in one place so the DI container * only needs `buildLogManagerConfig(env)`. */ export declare function buildLogManagerConfig(envVars: { DOLLHOUSE_LOG_DIR: string; DOLLHOUSE_LOG_FORMAT: 'text' | 'jsonl'; DOLLHOUSE_LOG_RETENTION_DAYS: number; DOLLHOUSE_LOG_SECURITY_RETENTION_DAYS: number; DOLLHOUSE_LOG_FLUSH_INTERVAL_MS: number; DOLLHOUSE_LOG_BUFFER_SIZE: number; DOLLHOUSE_LOG_MEMORY_CAPACITY: number; DOLLHOUSE_LOG_MEMORY_APP_CAPACITY: number; DOLLHOUSE_LOG_MEMORY_SECURITY_CAPACITY: number; DOLLHOUSE_LOG_MEMORY_PERF_CAPACITY: number; DOLLHOUSE_LOG_MEMORY_TELEMETRY_CAPACITY: number; DOLLHOUSE_LOG_MAX_ENTRY_SIZE: number; DOLLHOUSE_LOG_IMMEDIATE_FLUSH_RATE: number; DOLLHOUSE_LOG_FILE_MAX_SIZE: number; DOLLHOUSE_LOG_MAX_DIR_SIZE_BYTES: number; DOLLHOUSE_LOG_MAX_FILES_PER_CATEGORY: number; LOG_LEVEL: 'debug' | 'info' | 'warn' | 'error'; }): LogManagerConfig; //# sourceMappingURL=LogManager.d.ts.map