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
1 line
3.0 KiB
Plaintext
1 line
3.0 KiB
Plaintext
{"version":3,"file":"capture.js","sources":["../../../src/logs/capture.ts"],"sourcesContent":["import { format } from 'node:util';\nimport type { Log, LogSeverityLevel, ParameterizedString, Scope } from '@sentry/core';\nimport { _INTERNAL_captureLog } from '@sentry/core';\n\n/**\n * Additional metadata to capture the log with.\n */\ninterface CaptureLogMetadata {\n scope?: Scope;\n}\n\ntype CaptureLogArgWithTemplate = [\n messageTemplate: string,\n messageParams: Array<unknown>,\n attributes?: Log['attributes'],\n metadata?: CaptureLogMetadata,\n];\n\ntype CaptureLogArgWithoutTemplate = [\n message: ParameterizedString,\n attributes?: Log['attributes'],\n metadata?: CaptureLogMetadata,\n];\n\nexport type CaptureLogArgs = CaptureLogArgWithTemplate | CaptureLogArgWithoutTemplate;\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n */\nexport function captureLog(level: LogSeverityLevel, ...args: CaptureLogArgs): void {\n const [messageOrMessageTemplate, paramsOrAttributes, maybeAttributesOrMetadata, maybeMetadata] = args;\n if (Array.isArray(paramsOrAttributes)) {\n // type-casting here because from the type definitions we know that `maybeAttributesOrMetadata` is an attributes object (or undefined)\n const attributes = { ...(maybeAttributesOrMetadata as Log['attributes'] | undefined) };\n attributes['sentry.message.template'] = messageOrMessageTemplate;\n paramsOrAttributes.forEach((param, index) => {\n attributes[`sentry.message.parameter.${index}`] = param;\n });\n const message = format(messageOrMessageTemplate, ...paramsOrAttributes);\n _INTERNAL_captureLog({ level, message, attributes }, maybeMetadata?.scope);\n } else {\n _INTERNAL_captureLog(\n { level, message: messageOrMessageTemplate, attributes: paramsOrAttributes },\n // type-casting here because from the type definitions we know that `maybeAttributesOrMetadata` is a metadata object (or undefined)\n (maybeAttributesOrMetadata as CaptureLogMetadata | undefined)?.scope ?? maybeMetadata?.scope,\n );\n }\n}\n"],"names":["format","_INTERNAL_captureLog"],"mappings":";;;;;AAIA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB,GAAG,IAAI,EAAwB;AACnF,EAAE,MAAM,CAAC,wBAAwB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,aAAa,CAAA,GAAI,IAAI;AACvG,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;AACzC;AACA,IAAI,MAAM,aAAa,EAAE,IAAI,yBAAA,IAA6D;AAC1F,IAAI,UAAU,CAAC,yBAAyB,CAAA,GAAI,wBAAwB;AACpE,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK;AACjD,MAAM,UAAU,CAAC,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA,CAAA,GAAA,KAAA;AACA,IAAA,CAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAAA,WAAA,CAAA,wBAAA,EAAA,GAAA,kBAAA,CAAA;AACA,IAAAC,yBAAA,CAAA,EAAA,KAAA,EAAA,OAAA,EAAA,UAAA,EAAA,EAAA,aAAA,EAAA,KAAA,CAAA;AACA,EAAA,CAAA,MAAA;AACA,IAAAA,yBAAA;AACA,MAAA,EAAA,KAAA,EAAA,OAAA,EAAA,wBAAA,EAAA,UAAA,EAAA,kBAAA,EAAA;AACA;AACA,MAAA,CAAA,yBAAA,IAAA,KAAA,IAAA,aAAA,EAAA,KAAA;AACA,KAAA;AACA,EAAA;AACA;;;;"} |