Files
klz-cables.com/.pnpm-store/v10/files/fb/2deedfeec6efc2d3288951c5ed1285e00c4fe3015ae74214cf1bb0635b8e797d1b98cc8ce689aebefad04a29e28d646c4c808ce887f59c86fe91512437101c
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

44 lines
1.2 KiB
Plaintext

import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger.js';
import { fill } from '../utils/object.js';
import { GLOBAL_OBJ } from '../utils/worldwide.js';
import { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';
/**
* Add an instrumentation handler for when a console.xxx method is called.
*
* Use at your own risk, this might break without changelog notice, only used internally.
* @hidden
*/
function addConsoleInstrumentationHandler(handler) {
const type = 'console';
addHandler(type, handler);
maybeInstrument(type, instrumentConsole);
}
function instrumentConsole() {
if (!('console' in GLOBAL_OBJ)) {
return;
}
CONSOLE_LEVELS.forEach(function (level) {
if (!(level in GLOBAL_OBJ.console)) {
return;
}
fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod) {
originalConsoleMethods[level] = originalConsoleMethod;
return function (...args) {
const handlerData = { args, level };
triggerHandlers('console', handlerData);
const log = originalConsoleMethods[level];
log?.apply(GLOBAL_OBJ.console, args);
};
});
});
}
export { addConsoleInstrumentationHandler };
//# sourceMappingURL=console.js.map