Files
klz-cables.com/.pnpm-store/v10/files/fb/43a70b1ed5b3ffa25d2f34cec68dc9e9c0d69a617a459332fc99ae0f1d9dc06f2365fdcd4e09434529cfe7ef25da533152943996c57a41b9a0029717d428f7
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

1 line
5.5 KiB
Plaintext

{"version":3,"file":"console-integration.js","sources":["../../../src/logs/console-integration.ts"],"sourcesContent":["import { getClient } from '../currentScopes';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes';\nimport type { ConsoleLevel } from '../types-hoist/instrument';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport { CONSOLE_LEVELS, debug } from '../utils/debug-logger';\nimport { _INTERNAL_captureLog } from './internal';\nimport { createConsoleTemplateAttributes, formatConsoleArgs, hasConsoleSubstitutions } from './utils';\n\ninterface CaptureConsoleOptions {\n levels: ConsoleLevel[];\n}\n\nconst INTEGRATION_NAME = 'ConsoleLogs';\n\nconst DEFAULT_ATTRIBUTES = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.log.console',\n};\n\nconst _consoleLoggingIntegration = ((options: Partial<CaptureConsoleOptions> = {}) => {\n const levels = options.levels || CONSOLE_LEVELS;\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const { enableLogs, normalizeDepth = 3, normalizeMaxBreadth = 1_000 } = client.getOptions();\n if (!enableLogs) {\n DEBUG_BUILD && debug.warn('`enableLogs` is not enabled, ConsoleLogs integration disabled');\n return;\n }\n\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.includes(level)) {\n return;\n }\n\n const firstArg = args[0];\n const followingArgs = args.slice(1);\n\n if (level === 'assert') {\n if (!firstArg) {\n const assertionMessage =\n followingArgs.length > 0\n ? `Assertion failed: ${formatConsoleArgs(followingArgs, normalizeDepth, normalizeMaxBreadth)}`\n : 'Assertion failed';\n _INTERNAL_captureLog({ level: 'error', message: assertionMessage, attributes: DEFAULT_ATTRIBUTES });\n }\n return;\n }\n\n const isLevelLog = level === 'log';\n\n const shouldGenerateTemplate =\n args.length > 1 && typeof args[0] === 'string' && !hasConsoleSubstitutions(args[0]);\n const attributes = {\n ...DEFAULT_ATTRIBUTES,\n ...(shouldGenerateTemplate ? createConsoleTemplateAttributes(firstArg, followingArgs) : {}),\n };\n\n _INTERNAL_captureLog({\n level: isLevelLog ? 'info' : level,\n message: formatConsoleArgs(args, normalizeDepth, normalizeMaxBreadth),\n severityNumber: isLevelLog ? 10 : undefined,\n attributes,\n });\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Captures calls to the `console` API as logs in Sentry. Requires the `enableLogs` option to be enabled.\n *\n * @experimental This feature is experimental and may be changed or removed in future versions.\n *\n * By default the integration instruments `console.debug`, `console.info`, `console.warn`, `console.error`,\n * `console.log`, `console.trace`, and `console.assert`. You can use the `levels` option to customize which\n * levels are captured.\n *\n * @example\n *\n * ```ts\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * enableLogs: true,\n * integrations: [Sentry.consoleLoggingIntegration({ levels: ['error', 'warn'] })],\n * });\n * ```\n */\nexport const consoleLoggingIntegration = defineIntegration(_consoleLoggingIntegration);\n"],"names":["SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","CONSOLE_LEVELS","DEBUG_BUILD","debug","addConsoleInstrumentationHandler","getClient","formatConsoleArgs","_INTERNAL_captureLog","hasCons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