@rollercoaster-dev/rd-logger
Version:
A neurodivergent-friendly logger for Rollercoaster.dev projects
48 lines (47 loc) • 1.12 kB
TypeScript
import { Transport } from './transport.interface';
export interface FileTransportOptions {
/**
* Path to the log file
*/
filePath: string;
/**
* Whether to append to the log file
*/
append?: boolean;
}
/**
* File transport for the logger
*/
export declare class FileTransport implements Transport {
name: string;
private filePath;
private initialized;
private fileStream;
private logQueue;
private isProcessingQueue;
constructor(options: FileTransportOptions);
/**
* Initialize the file transport (called lazily)
*/
initialize(): void;
/**
* Log a message to the file
*/
log(level: string, message: string, timestamp: string, context: Record<string, any>): void;
/**
* Clean up resources used by the transport
*/
cleanup(): void;
/**
* Ensure the log directory exists
*/
private ensureLogDirectoryExists;
/**
* Initialize the file write stream
*/
private initializeFileStream;
/**
* Process the log queue asynchronously
*/
private processLogQueue;
}