logs-interceptor
Version:
High-performance, production-ready log interceptor for Node.js applications with Loki integration. Built with Clean Architecture principles. Supports Node.js, Browser, and Node-RED.
30 lines • 915 B
TypeScript
/**
* Infrastructure: Memory Buffer Implementation
*/
import { ILogBuffer, BufferMetrics } from '../../domain/interfaces/ILogBuffer';
import { LogEntry } from '../../domain/entities/LogEntry';
export interface MemoryBufferConfig {
readonly maxSize: number;
readonly flushInterval: number;
readonly maxAge: number;
readonly autoFlush: boolean;
readonly maxMemoryMB: number;
}
export declare class MemoryBuffer implements ILogBuffer {
private readonly config;
private entries;
private lastFlushTime;
private flushTimer;
constructor(config: MemoryBufferConfig);
add(entry: LogEntry): void;
flush(): LogEntry[];
peek(): readonly LogEntry[];
size(): number;
isFull(): boolean;
shouldFlush(): boolean;
clear(): void;
getMetrics(): BufferMetrics;
private removeOldEntries;
private scheduleFlush;
}
//# sourceMappingURL=MemoryBuffer.d.ts.map