@incubrain/logger
Version:
A modern, format-agnostic logging library for Node.js and browser environments, built on top of Consola with additional features for enterprise applications.
30 lines (29 loc) • 844 B
TypeScript
import type { ConsolaReporter, LogObject } from "consola";
/**
* ErrorReporter captures all error and warning logs to a separate file
* Particularly useful for development environments
*/
export declare class ErrorReporter implements ConsolaReporter {
private readonly options;
private fileLogger;
private readonly logLevel;
constructor(options?: {
filePath?: string;
maxFileSize?: number;
maxFiles?: number;
level?: number;
});
log(logObj: LogObject): void;
private sanitizeForJson;
private getTypeLevel;
end(): Promise<void>;
}
/**
* Creates an error reporter that only captures errors and warnings
*/
export declare function createErrorReporter(options?: {
filePath?: string;
maxFileSize?: number;
maxFiles?: number;
level?: number;
}): ErrorReporter;