@200systems/mf-logger
Version:
Structured logging with multiple outputs and performance timing for TypeScript applications
45 lines • 1.59 kB
TypeScript
import { LogEntry, LogOutput } from './types.js';
export declare abstract class BaseOutput {
abstract write(entry: LogEntry, formatted: string): Promise<void> | void;
}
export declare class ConsoleOutput extends BaseOutput {
write(entry: LogEntry, formatted: string): void;
}
export declare class FileOutput extends BaseOutput {
private readonly filePath;
private readonly maxSize;
private readonly maxFiles;
private fileHandler;
private initPromise;
constructor(filePath: string, maxSize?: number, // 10MB
maxFiles?: number);
write(entry: LogEntry, formatted: string): Promise<void>;
retrieveLogs(): Array<{
timestamp: string;
content: string;
}> | null;
clearLogs(): void;
}
export declare class CustomOutput extends BaseOutput {
private readonly handler;
constructor(handler: (entry: LogEntry) => void | Promise<void>);
write(entry: LogEntry): Promise<void>;
}
export declare class BrowserConsoleOutput extends BaseOutput {
write(entry: LogEntry, formatted: string): void;
private getConsoleStyles;
}
export declare class RemoteOutput extends BaseOutput {
private readonly endpoint;
private readonly batchSize;
private readonly flushInterval;
constructor(endpoint: string, batchSize?: number, flushInterval?: number);
private batch;
private batchTimer;
write(entry: LogEntry): Promise<void>;
private startBatchProcessor;
private flush;
destroy(): void;
}
export declare function createOutput(config: LogOutput): BaseOutput;
//# sourceMappingURL=outputs.d.ts.map