/** * Enumeration of log levels. * @enum {string} * @property {string} DEBUG - Debug log level. * @property {string} INFO - Info log level. * @property {string} WARN - Warning log level. * @property {string} ERROR - Error log level. */ export declare enum LOG_LEVELS { DEBUG = "DEBUG", INFO = "INFO", WARN = "WARN", ERROR = "ERROR" } /** * Configuration options for the logger. * @typedef {Object} LoggerConfig * @property {boolean | Array} [sensitiveFilteringKeywords] - Specifies whether to filter sensitive keywords in log messages. Can be a boolean value or an array of strings. * @property {LOG_LEVELS | string} [logLevel] - The log level to use for logging. Can be one of the predefined log levels or a custom string value. */ export type LoggerConfig = { sensitiveFilteringKeywords?: boolean | Array; logLevel?: LOG_LEVELS | string; /** When true, all log output is suppressed (e.g. health check routes). */ silent?: boolean; }; /** * Logger class for logging messages with different log levels. */ export default class Logger { /** * The optional configuration object for the logger. */ private config?; /** * Private property representing the transaction ID. * @type {string} * @private */ private transactionID; /** * An array of strings representing a blacklist of filters */ private filterBlacklist; /** * The current log level for the application. * @private * @type {LOG_LEVELS} */ private _LOG_LEVEL; /** * The origin of the object. * @private * @type {any} */ private origin; /** * Constructs a Logger object with the given configuration and transaction ID. * @param {config} config - The configuration object for the logger. Can be undefined. * @param {string} transactionID - The ID of the transaction associated with the logger. * @returns None */ constructor(config: LoggerConfig | undefined, transactionID: string); /** * Returns a boolean value indicating whether the notGlobalLogger function is executed successfully. * @returns {boolean} - true if the function is executed successfully, false otherwise. */ notGlobalLogger(): boolean; /** * Logs the given arguments with the debug log level. * @param {...any} args - The arguments to be logged. * @returns None */ debug(...args: any[]): void; /** * Logs the given arguments with the INFO log level. * @param {...any} args - The arguments to be logged. * @returns None */ log(...args: any[]): void; /** * Logs an informational message. * @param {...any} args - The message(s) to log. * @returns None */ info(...args: any[]): void; /** * Logs a warning message with the provided arguments. * @param {...any} args - The arguments to be logged as a warning message. * @returns None */ warning(...args: any[]): void; /** * Logs a warning message to the console. * @param {...any} args - The arguments to be logged. * @returns None */ warn(...args: any[]): void; /** * Logs an error message with the given arguments. * @param {...any} args - The arguments to log as an error message. * @returns None */ error(...args: any[]): void; /** * Logs an exception with optional additional arguments. * @param {any} exception - The exception to log. * @param {...any} args - Additional arguments to include in the log. * @returns None */ exception(exception: Error | unknown, ...args: any[]): void; /** * Sets up the console bindings for logging purposes. * @private * @returns None */ private setupBindings; /** * Formats a log message with the specified log level, message, and caller. * @param {LOG_LEVELS} level - The log level of the message. * @param {Array} msg - An array of strings representing the message. * @param {string} caller - The name of the caller function. * @returns {string} - The formatted log message. */ private formattedLog; /** * Retrieves the name of the caller function at the specified index in the stack trace. * @param {number} index - The index of the caller function in the stack trace. * @returns {string} The name of the caller function along with the file path and line number. */ private callerName; /** * Processes log messages based on the specified log level. * @param {LOG_LEVELS} level - The level of the log message. * @param {any} args - The arguments to be logged. * @returns None */ private processLog; private formatArgument; /** * Logs an exception along with additional arguments and the stack trace. * @param {Error} exception - The exception object to log. * @param {...any} args - Additional arguments to include in the log. * @returns None */ private iexception; /** * Pushes a log message to the console with the specified log level. * @param {LOG_LEVELS} level - The log level of the message. * @param {string} fMsg - The formatted log message. * @returns None */ private pushLog; /** * Suppresses sensitive information in the given value based on the filter blacklist. * @param {any} value - The value to suppress sensitive information from. * @returns {string} - The value with sensitive information suppressed. */ private suppressSensitiveInfo; private suppressSensitiveInfoItem; private suppressSensitiveString; private suppressSensitiveObject; }