artmapper
Version:
A simple and intuitive ORM for Node.js with TypeScript and JavaScript support
48 lines • 1.42 kB
TypeScript
export interface LoggingConfig {
enabled: boolean;
level: 'error' | 'warn' | 'info' | 'debug';
queries: boolean;
errors: boolean;
warnings: boolean;
slowQueries: boolean;
slowQueryThreshold: number;
file?: string;
console: boolean;
format: 'json' | 'text';
maxFileSize: number;
maxFiles: number;
}
export interface LogEntry {
timestamp: string;
level: string;
message: string;
data?: any;
model?: string;
operation?: string;
duration?: number;
sql?: string;
params?: any[];
error?: string;
}
export declare class Logger {
private config;
private logStream;
private currentFileSize;
constructor(config: LoggingConfig);
private initializeFileLogging;
private rotateLogFile;
log(level: string, message: string, data?: any): void;
private formatLogEntry;
private logToConsole;
private logToFile;
error(message: string, data?: any): void;
warn(message: string, data?: any): void;
info(message: string, data?: any): void;
debug(message: string, data?: any): void;
logQuery(sql: string, params?: any[], duration?: number): void;
logSlowQuery(sql: string, params?: any[], duration?: number): void;
logModelOperation(model: string, operation: string, data?: any): void;
logError(error: Error, context?: any): void;
close(): void;
}
//# sourceMappingURL=logger.d.ts.map