z-mmap-logger
Version:
High-performance logging for NestJS using memory-mapped files
30 lines (29 loc) • 895 B
TypeScript
import { LoggerService } from '@nestjs/common';
export declare class ZMmapLogger implements LoggerService {
private buffer;
private fd;
private offset;
private readonly maxSize;
private readonly logFile;
constructor(options?: {
maxSize?: number;
logDir?: string;
});
log(message: string, context?: string): void;
error(message: string, trace?: string, context?: string): void;
warn(message: string, context?: string): void;
debug(message: string, context?: string): void;
verbose(message: string, context?: string): void;
/**
* Write a log entry to the memory-mapped file
*/
private writeLog;
/**
* Close the file descriptor when the logger is no longer needed
*/
close(): void;
}
export declare function createZMmapLogger(options?: {
maxSize?: number;
logDir?: string;
}): ZMmapLogger;