@incubrain/logger
Version:
A modern, type-safe logging library for Node.js and browser environments, built on top of Consola with additional features for enterprise applications.
67 lines • 1.8 kB
TypeScript
import type { PromptOptions, LogObject } from "consola";
import type { LoggerOptions } from "./types";
type SelectOption = {
label: string;
value: string;
hint?: string;
};
export declare class Logger {
private static instance;
private consola;
private reporters;
private errorHandler;
private static loggerCache;
private options;
private readonly defaultLabels;
private constructor();
private safeClone;
private formatLogEntry;
private formatMessage;
private formatData;
private shouldLog;
private sanitizeContext;
private sanitizeValue;
static getInstance(options?: LoggerOptions): Logger;
/**
* Create a new logger with additional context
*/
withContext(context: Record<string, any>): Logger;
setLevel(level: number): void;
end(): Promise<void>;
callReporters(logObj: LogObject): void;
prompt(message: string, options: PromptOptions | undefined): Promise<string | boolean | SelectOption | (string | SelectOption)[]>;
/**
* Debug level logging
*/
debug(message: any, ...args: any[]): void;
/**
* Info level logging
*/
info(message: any, ...args: any[]): void;
/**
* Success level logging
*/
success(message: any, ...args: any[]): void;
/**
* Warning level logging
*/
warn(message: any, ...args: any[]): void;
/**
* Error level logging
*/
error(message: any, ...args: any[]): void;
/**
* Fatal level logging
*/
fatal(message: any, ...args: any[]): void;
/**
* Trace level logging
*/
trace(message: any, ...args: any[]): void;
/**
* Generic logging method
*/
log(message: any, ...args: any[]): void;
}
export {};
//# sourceMappingURL=logger.d.ts.map