UNPKG

@johntad/m-pesa

Version:

A TypeScript SDK for integrating M-Pesa mobile payment services into applications, enabling seamless money transfers and transactions.

78 lines (77 loc) 2.69 kB
/** * Defines the severity levels for log messages. * * This enum provides a standardized set of log levels to categorize the importance * and urgency of log messages generated by the application. * * @enum {number} * * @property {number} Emergency - Indicates a system-wide message that immediately jeopardizes the system and may require immediate action. * @property {number} Alert - A serious problem that requires immediate attention. * @property {number} Critical - A critical condition that, although not immediately life-threatening, requires immediate attention. * @property {number} Error - An error condition. * @property {number} Warning - A warning condition. * @property {number} Notice - A normal but significant condition. * @property {number} Informational - Informational messages. * @property {number} Debug - Debug-level messages for development and troubleshooting. */ export declare enum LogLevel { Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Informational = 6, Debug = 7 } /** * A logger utility for standardized logging. */ export declare class Logger { private minLogLevel; /** * Creates a new Logger instance. * @param minLogLevel - The minimum log level to capture (default is Informational). */ constructor(minLogLevel?: LogLevel); /** * Logs a message if the specified level meets the minimum log level. * @param level - The log level for this message. * @param message - The log message. * @param context - Additional contextual information (optional). */ private log; /** * Logs an emergency message (level 0). */ logEmergency(message: string, context?: Record<string, unknown>): void; /** * Logs an alert message (level 1). */ logAlert(message: string, context?: Record<string, unknown>): void; /** * Logs a critical message (level 2). */ logCritical(message: string, context?: Record<string, unknown>): void; /** * Logs an error message (level 3). */ logError(message: string, context?: Record<string, unknown>): void; /** * Logs a warning message (level 4). */ logWarning(message: string, context?: Record<string, unknown>): void; /** * Logs a notice message (level 5). */ logNotice(message: string, context?: Record<string, unknown>): void; /** * Logs an informational message (level 6). */ logInfo(message: string, context?: Record<string, unknown>): void; /** * Logs a debug message (level 7). */ logDebug(message: string, context?: Record<string, unknown>): void; }