"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.enhanceStandardConsoleLogging = enhanceStandardConsoleLogging;
const CONSOLE_TYPES = ['debug', 'log', 'info', 'warn', 'error'];
/**
 * Enhances the standard console logging by calling the provided log function after each console method call.
 * It's usually used to send the logs to a remote server or some similar use case.
 * It keeps calling the original console method before calling the log function.
 * For better debugging, the original functions are stored in the `console.__next` object and the log function is stored in `console.__enhancer`.
 */
function enhanceStandardConsoleLogging(logFunction) {
    CONSOLE_TYPES.forEach((type) => {
        const consoleMethod = global.console[type];
        const combinedFn = (...args) => {
            consoleMethod.apply(global.console, args);
            logFunction(type, ...args);
        };
        combinedFn.__next = consoleMethod;
        combinedFn.__enhancer = logFunction;
        global.console[type] = combinedFn;
    });
}
//# sourceMappingURL=enhancer.js.map