@454creative/easy-email
Version:
A framework-agnostic email service library for Node.js with observability and monitoring
49 lines • 1.44 kB
TypeScript
export declare enum LogLevel {
DEBUG = "debug",
INFO = "info",
WARN = "warn",
ERROR = "error"
}
export interface LogEntry {
timestamp: string;
level: LogLevel;
message: string;
details?: any;
}
export interface Metrics {
totalEmailsSent: number;
successfulEmails: number;
failedEmails: number;
averageSendTime: number;
lastError?: LogEntry;
}
export declare class Logger {
private static instance;
private logLevel;
private logs;
private metrics;
private startTime?;
private constructor();
static getInstance(): Logger;
setLogLevel(level: LogLevel): void;
debug(message: string, details?: any): void;
info(message: string, details?: any): void;
warn(message: string, details?: any): void;
error(message: string, details?: any): void;
private log;
private shouldLog;
startOperation(): void;
endOperation(success: boolean): void;
getMetrics(): Metrics;
getLogs(level?: LogLevel): LogEntry[];
clearLogs(): void;
resetMetrics(): void;
/**
* Create a standardized log entry for email operations
* @param operation - The email operation being performed
* @param success - Whether the operation was successful
* @param details - Additional details about the operation
*/
logEmailOperation(operation: string, success: boolean, details?: any): void;
}
//# sourceMappingURL=logger.d.ts.map