package.build.esm.instrument.console.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils Show documentation
Show all versions of utils Show documentation
Utilities for all Sentry JavaScript SDKs
The newest version!
{"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '@sentry/types';\n\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../logger';\nimport { fill } from '../object';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n const handlerData: HandlerDataConsole = { args, level };\n triggerHandlers('console', handlerData);\n\n const log = originalConsoleMethods[level];\n log && log.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n"],"names":[],"mappings":";;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA4C;AACpG,EAAE,MAAM,IAAK,GAAE,SAAS;AACxB,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,EAAE,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC1C;;AAEA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,EAAE,aAAa,UAAU,CAAC,EAAE;AAClC,IAAI;AACJ;;AAEA,EAAE,cAAc,CAAC,OAAO,CAAC,UAAU,KAAK,EAAsB;AAC9D,IAAI,IAAI,EAAE,KAAA,IAAS,UAAU,CAAC,OAAO,CAAC,EAAE;AACxC,MAAM;AACN;;AAEA,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,qBAAqB,EAAuB;AAC1F,MAAM,sBAAsB,CAAC,KAAK,CAAA,GAAI,qBAAqB;;AAE3D,MAAM,OAAO,UAAU,GAAG,IAAI,EAAe;AAC7C,QAAQ,MAAM,WAAW,GAAuB,EAAE,IAAI,EAAE,OAAO;AAC/D,QAAQ,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC;;AAE/C,QAAQ,MAAM,GAAI,GAAE,sBAAsB,CAAC,KAAK,CAAC;AACjD,QAAQ,GAAA,IAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAClD,OAAO;AACP,KAAK,CAAC;AACN,GAAG,CAAC;AACJ;;;;"}