SmartFileTransport - Multiple auto-flush triggers
const smartLogger = new Logger(LogLevel.INFO, [ new SmartFileTransport('./smart.log', new JSONFormatter(), LogLevel.INFO, { enabled: true, interval: 5000, // Auto-flush every 5 seconds onSize: 50, // Auto-flush when 50 logs buffered onLevel: LogLevel.ERROR, // Immediate flush for ERROR/FATAL logs onIdle: 10000 // Auto-flush after 10 seconds of no new logs })]); Copy
const smartLogger = new Logger(LogLevel.INFO, [ new SmartFileTransport('./smart.log', new JSONFormatter(), LogLevel.INFO, { enabled: true, interval: 5000, // Auto-flush every 5 seconds onSize: 50, // Auto-flush when 50 logs buffered onLevel: LogLevel.ERROR, // Immediate flush for ERROR/FATAL logs onIdle: 10000 // Auto-flush after 10 seconds of no new logs })]);
SmartFileTransport - Multiple auto-flush triggers
Example