@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
59 lines (58 loc) • 1.58 kB
TypeScript
export declare enum LogLevel {
DEBUG = 0,
INFO = 1,
WARN = 2,
ERROR = 3,
SUCCESS = 4,
SILENT = 99
}
export interface LogEntry {
level: LogLevel;
timestamp: Date;
message: string;
context?: Record<string, any>;
error?: Error;
}
export interface LoggerOptions {
level?: LogLevel;
file?: string;
maxFileSize?: number;
maxFiles?: number;
json?: boolean;
timestamp?: boolean;
color?: boolean;
context?: Record<string, any>;
}
export declare class Logger {
private level;
private file?;
private maxFileSize;
private maxFiles;
private json;
private timestamp;
private color;
private context;
private fileStream?;
private currentFileSize;
private rotationIndex;
constructor(options?: LoggerOptions);
private initializeFile;
private rotateFile;
private shouldLog;
private formatMessage;
private getLevelString;
private log;
debug(message: string, ...args: any[]): void;
info(message: string, ...args: any[]): void;
warn(message: string, ...args: any[]): void;
error(message: string, error?: Error | any, ...args: any[]): void;
success(message: string, ...args: any[]): void;
private extractContext;
setLevel(level: LogLevel): void;
getLevel(): LogLevel;
child(context: Record<string, any>): Logger;
close(): void;
}
export declare function createLogger(options?: LoggerOptions): Logger;
export declare function getGlobalLogger(): Logger;
export declare function setGlobalLogger(logger: Logger): void;