diff --git a/CHANGELOG.md b/CHANGELOG.md index 68d0b34544..f4042c4f91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ - Bump Android SDK from v8.17.0 to v8.20.0 ([#5034](https://github.com/getsentry/sentry-react-native/pull/5034), [#5063](https://github.com/getsentry/sentry-react-native/pull/5063), [#5106](https://github.com/getsentry/sentry-react-native/pull/5106)) - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8200) - [diff](https://github.com/getsentry/sentry-java/compare/8.17.0...8.20.0) +- Bump JavaScript SDK from v9.22.0 to v10.7.0 ([#5111](https://github.com/getsentry/sentry-react-native/pull/5111)) + - [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#1070) + - [diff](https://github.com/getsentry/sentry-javascript/compare/9.22.0...10.7.0) + ## 7.0.0-rc.1 diff --git a/dev-packages/e2e-tests/package.json b/dev-packages/e2e-tests/package.json index 52deb19096..e1b6f36caa 100644 --- a/dev-packages/e2e-tests/package.json +++ b/dev-packages/e2e-tests/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@babel/preset-env": "^7.25.3", "@babel/preset-typescript": "^7.18.6", - "@sentry/core": "9.22.0", + "@sentry/core": "10.7.0", "@sentry/react-native": "7.0.0-rc.1", "@types/node": "^20.9.3", "@types/react": "^18.2.64", diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.build.gradle.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.build.gradle.js index 8eec66240b..c6ae9712af 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.build.gradle.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.build.gradle.js @@ -4,15 +4,15 @@ const fs = require('fs'); const { argv } = require('process'); const parseArgs = require('minimist'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const args = parseArgs(argv.slice(2)); if (!args['app-build-gradle']) { throw new Error('Missing --app-build-gradle'); } -logger.info('Patching app/build.gradle', args['app-build-gradle']); +debug.log('Patching app/build.gradle', args['app-build-gradle']); const sentryGradlePatch = ` apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle") @@ -26,7 +26,7 @@ if (!isPatched) { const patched = buildGradle.replace(reactNativeGradleRex, m => sentryGradlePatch + m); fs.writeFileSync(args['app-build-gradle'], patched); - logger.info('Patched app/build.gradle successfully!'); + debug.log('Patched app/build.gradle successfully!'); } else { - logger.info('app/build.gradle is already patched!'); + debug.log('app/build.gradle is already patched!'); } diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js index 3fd9f5f825..2a6ac3b14d 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js @@ -5,8 +5,8 @@ const path = require('path'); const { argv, env } = require('process'); const parseArgs = require('minimist'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const SENTRY_RELEASE = env.SENTRY_RELEASE; const SENTRY_DIST = env.SENTRY_DIST; @@ -16,7 +16,7 @@ if (!args.app) { throw new Error('Missing --app'); } -logger.info('Patching RN App.(js|tsx)', args.app); +debug.log('Patching RN App.(js|tsx)', args.app); const initPatch = ` import * as Sentry from '@sentry/react-native'; @@ -59,7 +59,7 @@ if (!isPatched) { .replace(exportDefaultRex, 'export default Sentry.wrap(App);'); fs.writeFileSync(appPath, patched); - logger.info('Patched RN App.(js|tsx) successfully!'); + debug.log('Patched RN App.(js|tsx) successfully!'); } else { - logger.info('App.(js|tsx) already patched!'); + debug.log('App.(js|tsx) already patched!'); } diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.gradle.properties.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.gradle.properties.js index 2292e52a3e..3d7ac3ff92 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.gradle.properties.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.gradle.properties.js @@ -4,8 +4,8 @@ const fs = require('fs'); const { argv } = require('process'); const parseArgs = require('minimist'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const args = parseArgs(argv.slice(2)); if (!args['gradle-properties']) { @@ -21,7 +21,7 @@ if (enableHermes === null) { throw new Error('Invalid engine'); } -logger.info('Patching gradle.properties', args['gradle-properties']); +debug.log('Patching gradle.properties', args['gradle-properties']); let content = fs.readFileSync(args['gradle-properties'], 'utf8'); const isHermesEnabled = content.includes('hermesEnabled=true'); @@ -31,9 +31,9 @@ if (enableHermes !== isHermesEnabled) { ? content.replace(/hermesEnabled=.*/g, patch) : content.concat(`\n${patch}`); if (enableHermes) { - logger.info('Patching gradle.properties for Hermes'); + debug.log('Patching gradle.properties for Hermes'); } else { - logger.info('Patching gradle.properties for JSC'); + debug.log('Patching gradle.properties for JSC'); } } diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.metro.config.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.metro.config.js index b92d2a983b..ea648ec449 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.metro.config.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.metro.config.js @@ -4,15 +4,15 @@ const fs = require('fs'); const { argv } = require('process'); const parseArgs = require('minimist'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const args = parseArgs(argv.slice(2)); if (!args.path) { throw new Error('Missing --path'); } -logger.info('Patching Metro config: ', args.path); +debug.log('Patching Metro config: ', args.path); const configFilePath = args.path; @@ -52,7 +52,7 @@ if (!isPatched) { } fs.writeFileSync(configFilePath, config.join('\n'), 'utf8'); - logger.info('Patched Metro config successfully!'); + debug.log('Patched Metro config successfully!'); } else { - logger.info('Metro config already patched!'); + debug.log('Metro config already patched!'); } diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js index 44aed0693c..db43b54b54 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js @@ -4,8 +4,8 @@ const fs = require('fs'); const { argv } = require('process'); const parseArgs = require('minimist'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const args = parseArgs(argv.slice(2)); if (!args['pod-file']) { @@ -21,7 +21,7 @@ if (enableHermes === null) { throw new Error('Invalid engine'); } -logger.info('Patching Podfile', args['pod-file']); +debug.log('Patching Podfile', args['pod-file']); const content = fs.readFileSync(args['pod-file'], 'utf8'); const isHermesEnabled = content.includes(':hermes_enabled => true,'); @@ -32,11 +32,11 @@ if (shouldPatch) { enableHermes ? ':hermes_enabled => true,' : ':hermes_enabled => false,', ); if (enableHermes) { - logger.info('Patching Podfile for Hermes'); + debug.log('Patching Podfile for Hermes'); } else { - logger.info('Patching Podfile for JSC'); + debug.log('Patching Podfile for JSC'); } fs.writeFileSync(args['pod-file'], patched); } else { - logger.info('Podfile is already patched!'); + debug.log('Podfile is already patched!'); } diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js index d044817df2..072a885720 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js @@ -6,8 +6,8 @@ const { argv } = require('process'); const xcode = require('xcode'); const parseArgs = require('minimist'); const semver = require('semver'); -const { logger } = require('@sentry/core'); -logger.enable(); +const { debug } = require('@sentry/core'); +debug.enable(); const args = parseArgs(argv.slice(2)); if (!args.project) { @@ -17,7 +17,7 @@ if (!args['rn-version']) { throw new Error('Missing --rn-version'); } -logger.info('Patching Xcode project', args.project, 'for RN version', args['rn-version']); +debug.log('Patching Xcode project', args.project, 'for RN version', args['rn-version']); const newBundleScriptRNVersion = '0.69.0-rc.0'; @@ -29,7 +29,7 @@ const symbolsScript = ` `; const symbolsPatchRegex = /sentry-cli\s+(upload-dsym|debug-files upload)/; if (semver.satisfies(args['rn-version'], `< ${newBundleScriptRNVersion}`, { includePrerelease: true })) { - logger.info('Applying old bundle script patch'); + debug.log('Applying old bundle script patch'); bundleScript = ` export NODE_BINARY=node ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh ../node_modules/react-native/scripts/react-native-xcode.sh @@ -37,7 +37,7 @@ export NODE_BINARY=node bundleScriptRegex = /(packager|scripts)\/react-native-xcode\.sh\b/; bundlePatchRegex = /sentry-cli\s+react-native[\s-]xcode/; } else if (semver.satisfies(args['rn-version'], `>= ${newBundleScriptRNVersion}`, { includePrerelease: true })) { - logger.info('Applying new bundle script patch'); + debug.log('Applying new bundle script patch'); bundleScript = ` WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh" REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh" @@ -62,38 +62,32 @@ for (const key in buildPhasesRaw) { } } -buildPhases.forEach((phase) => { +buildPhases.forEach(phase => { const isBundleReactNative = phase.shellScript.match(bundleScriptRegex); const isPatched = phase.shellScript.match(bundlePatchRegex); if (!isBundleReactNative) { return; } if (isPatched) { - logger.warn('Xcode project Bundle RN Build phase already patched'); + debug.warn('Xcode project Bundle RN Build phase already patched'); return; } phase.shellScript = JSON.stringify(bundleScript); - logger.info('Patched Xcode project Bundle RN Build phase'); + debug.log('Patched Xcode project Bundle RN Build phase'); }); -const isSymbolsPhase = (phase) => phase.shellScript.match(symbolsPatchRegex); +const isSymbolsPhase = phase => phase.shellScript.match(symbolsPatchRegex); const areSymbolsPatched = buildPhases.some(isSymbolsPhase); if (!areSymbolsPatched) { - project.addBuildPhase( - [], - 'PBXShellScriptBuildPhase', - 'Upload Debug Symbols to Sentry', - null, - { - shellPath: '/bin/sh', - shellScript: symbolsScript, - }, - ); - logger.info('Added Xcode project Upload Debug Symbols Build phase'); + project.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, { + shellPath: '/bin/sh', + shellScript: symbolsScript, + }); + debug.log('Added Xcode project Upload Debug Symbols Build phase'); } else { - logger.warn('Xcode project Upload Debug Symbols Build phase already patched'); + debug.warn('Xcode project Upload Debug Symbols Build phase already patched'); } fs.writeFileSync(args.project, project.writeSync()); -logger.info('Patched Xcode project successfully!'); +debug.log('Patched Xcode project successfully!'); diff --git a/dev-packages/type-check/ts3.8-test/tsconfig.build.json b/dev-packages/type-check/ts3.8-test/tsconfig.build.json index 28d4363cb9..5b4837604c 100644 --- a/dev-packages/type-check/ts3.8-test/tsconfig.build.json +++ b/dev-packages/type-check/ts3.8-test/tsconfig.build.json @@ -3,7 +3,7 @@ "index.ts", ], "compilerOptions": { - "skipLibCheck": false, + "skipLibCheck": true, "noEmit": true, "importHelpers": true, "types": [], diff --git a/packages/core/package.json b/packages/core/package.json index 3b2b8ce95f..45ff9f731a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -66,20 +66,20 @@ }, "dependencies": { "@sentry/babel-plugin-component-annotate": "4.0.2", - "@sentry/browser": "9.22.0", + "@sentry/browser": "10.7.0", "@sentry/cli": "2.50.2", - "@sentry/core": "9.22.0", - "@sentry/react": "9.22.0", - "@sentry/types": "9.22.0" + "@sentry/core": "10.7.0", + "@sentry/react": "10.7.0", + "@sentry/types": "10.7.0" }, "devDependencies": { "@babel/core": "^7.25.2", "@expo/metro-config": "~0.20.0", "@mswjs/interceptors": "^0.25.15", "@react-native/babel-preset": "0.77.1", - "@sentry-internal/eslint-config-sdk": "9.22.0", - "@sentry-internal/eslint-plugin-sdk": "9.22.0", - "@sentry-internal/typescript": "9.22.0", + "@sentry-internal/eslint-config-sdk": "10.7.0", + "@sentry-internal/eslint-plugin-sdk": "10.7.0", + "@sentry-internal/typescript": "10.7.0", "@sentry/wizard": "6.1.0", "@testing-library/react-native": "^12.7.2", "@types/jest": "^29.5.13", diff --git a/packages/core/src/js/client.ts b/packages/core/src/js/client.ts index 957aae9f5c..9f0b918d5e 100644 --- a/packages/core/src/js/client.ts +++ b/packages/core/src/js/client.ts @@ -14,9 +14,9 @@ import { _INTERNAL_flushLogsBuffer, addAutoIpAddressToSession, addAutoIpAddressToUser, - BaseClient, + Client, dateTimestampInSeconds, - logger, + debug, SentryError, } from '@sentry/core'; import { Alert } from 'react-native'; @@ -40,7 +40,7 @@ const DEFAULT_FLUSH_INTERVAL = 5000; * @see ReactNativeClientOptions for documentation on configuration options. * @see SentryClient for usage documentation. */ -export class ReactNativeClient extends BaseClient { +export class ReactNativeClient extends Client { private _outcomesBuffer: Outcome[]; private _logFlushIdleTimeout: ReturnType | undefined; @@ -147,13 +147,13 @@ export class ReactNativeClient extends BaseClient { // SentryError is thrown by SyncPromise shouldClearOutcomesBuffer = false; // If this is called asynchronously we want the _outcomesBuffer to be cleared - logger.error('SentryError while sending event, keeping outcomes buffer:', reason); + debug.error('SentryError while sending event, keeping outcomes buffer:', reason); } else { - logger.error('Error while sending event:', reason); + debug.error('Error while sending event:', reason); } }); } else { - logger.error('Transport disabled'); + debug.error('Transport disabled'); } if (shouldClearOutcomesBuffer) { @@ -219,7 +219,7 @@ export class ReactNativeClient extends BaseClient { this.emit('afterInit'); }) .then(undefined, error => { - logger.error('The OnReady callback threw an error: ', error); + debug.error('The OnReady callback threw an error: ', error); }); } diff --git a/packages/core/src/js/feedback/FeedbackWidget.tsx b/packages/core/src/js/feedback/FeedbackWidget.tsx index 009c5da68f..2725b3747a 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.tsx +++ b/packages/core/src/js/feedback/FeedbackWidget.tsx @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ import type { SendFeedbackParams, User } from '@sentry/core'; -import { captureFeedback, getCurrentScope, getGlobalScope, getIsolationScope, lastEventId, logger } from '@sentry/core'; +import { captureFeedback, debug, getCurrentScope, getGlobalScope, getIsolationScope, lastEventId } from '@sentry/core'; import * as React from 'react'; import type { KeyboardTypeOptions , NativeEventSubscription} from 'react-native'; @@ -147,7 +147,7 @@ export class FeedbackWidget extends React.Component imagePicker.launchImageLibrary?.({ mediaType: 'photo', includeBase64: isWeb() }) : null; if (!launchImageLibrary) { - logger.warn('No compatible image picker library found. Please provide a valid image picker library.'); + debug.warn('No compatible image picker library found. Please provide a valid image picker library.'); if (__DEV__) { feedbackAlertDialog( 'Development note', @@ -183,7 +183,7 @@ export class FeedbackWidget extends React.Component { this._showImageRetrievalDevelopmentNote(); - logger.error('Failed to read image data from uri:', imageUri, 'error: ', error); + debug.error('Failed to read image data from uri:', imageUri, 'error: ', error); }); } } @@ -213,11 +213,11 @@ export class FeedbackWidget extends React.Component { this._showImageRetrievalDevelopmentNote(); - logger.error('Failed to read image data from uri:', uri, 'error: ', error); + debug.error('Failed to read image data from uri:', uri, 'error: ', error); }); }); } @@ -380,21 +380,21 @@ export class FeedbackWidget extends React.Component { if (screenshot.data != null) { - logger.debug('Setting captured screenshot:', screenshot.filename); + debug.log('Setting captured screenshot:', screenshot.filename); NATIVE.encodeToBase64(screenshot.data) .then(base64String => { if (base64String != null) { const dataUri = `data:${screenshot.contentType};base64,${base64String}`; this.setState({ filename: screenshot.filename, attachment: screenshot.data, attachmentUri: dataUri }); } else { - logger.error('Failed to read image data from:', screenshot.filename); + debug.error('Failed to read image data from:', screenshot.filename); } }) .catch(error => { - logger.error('Failed to read image data from:', screenshot.filename, 'error: ', error); + debug.error('Failed to read image data from:', screenshot.filename, 'error: ', error); }); } else { - logger.error('Failed to read image data from:', screenshot.filename); + debug.error('Failed to read image data from:', screenshot.filename); } }; diff --git a/packages/core/src/js/feedback/FeedbackWidgetManager.tsx b/packages/core/src/js/feedback/FeedbackWidgetManager.tsx index 904bdc123a..505bf5e6da 100644 --- a/packages/core/src/js/feedback/FeedbackWidgetManager.tsx +++ b/packages/core/src/js/feedback/FeedbackWidgetManager.tsx @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { isWeb } from '../utils/environment'; import { lazyLoadAutoInjectFeedbackButtonIntegration,lazyLoadAutoInjectFeedbackIntegration, lazyLoadAutoInjectScreenshotButtonIntegration } from './lazy'; @@ -117,7 +117,7 @@ const resetFeedbackButtonManager = (): void => { const showScreenshotButton = (): void => { if (isWeb()) { - logger.warn('ScreenshotButton is not supported on Web.'); + debug.warn('ScreenshotButton is not supported on Web.'); return; } lazyLoadAutoInjectScreenshotButtonIntegration(); diff --git a/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx b/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx index 2e73788ea2..1c2c8bab73 100644 --- a/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx +++ b/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import * as React from 'react'; import { type NativeEventSubscription, type NativeScrollEvent,type NativeSyntheticEvent, Animated, Appearance, Dimensions, Easing, Modal, PanResponder, Platform, ScrollView, View } from 'react-native'; import { notWeb } from '../utils/environment'; @@ -128,7 +128,7 @@ export class FeedbackWidgetProvider extends React.Component { - logger.info('FeedbackWidgetProvider componentDidUpdate'); + debug.log('FeedbackWidgetProvider componentDidUpdate'); }); } else if (prevState.isVisible && !this.state.isVisible) { this.state.backgroundOpacity.setValue(0); @@ -140,7 +140,7 @@ export class FeedbackWidgetProvider extends React.Component{this.props.children}; } diff --git a/packages/core/src/js/integrations/appRegistry.ts b/packages/core/src/js/integrations/appRegistry.ts index 25634e0b25..73041354c0 100644 --- a/packages/core/src/js/integrations/appRegistry.ts +++ b/packages/core/src/js/integrations/appRegistry.ts @@ -1,5 +1,5 @@ import type { Client, Integration } from '@sentry/core'; -import { getClient, logger } from '@sentry/core'; +import { debug, getClient } from '@sentry/core'; import { isWeb } from '../utils/environment'; import { fillTyped } from '../utils/fill'; import { ReactNativeLibraries } from '../utils/rnlibraries'; @@ -22,7 +22,7 @@ export const appRegistryIntegration = (): Integration & { }, onRunApplication: (callback: () => void) => { if (callbacks.includes(callback)) { - logger.debug('[AppRegistryIntegration] Callback already registered.'); + debug.log('[AppRegistryIntegration] Callback already registered.'); return; } callbacks.push(callback); diff --git a/packages/core/src/js/integrations/debugsymbolicator.ts b/packages/core/src/js/integrations/debugsymbolicator.ts index f17ec90d55..8daafd0005 100644 --- a/packages/core/src/js/integrations/debugsymbolicator.ts +++ b/packages/core/src/js/integrations/debugsymbolicator.ts @@ -1,5 +1,5 @@ import type { Event, EventHint, Exception, Integration, StackFrame as SentryStackFrame } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import type { ExtendedError } from '../utils/error'; import { getFramesToPop, isErrorLike } from '../utils/error'; import type * as ReactNative from '../vendor/react-native'; @@ -70,7 +70,7 @@ async function symbolicate(rawStack: string, skipFirstFrames: number = 0): Promi const prettyStack = await symbolicateStackTrace(parsedStack); if (!prettyStack) { - logger.error('React Native DevServer could not symbolicate the stack trace.'); + debug.error('React Native DevServer could not symbolicate the stack trace.'); return null; } @@ -92,7 +92,7 @@ async function symbolicate(rawStack: string, skipFirstFrames: number = 0): Promi return await fetchSourceContext(sentryFrames); } catch (error) { if (error instanceof Error) { - logger.warn(`Unable to symbolicate stack trace: ${error.message}`); + debug.warn(`Unable to symbolicate stack trace: ${error.message}`); } return null; } diff --git a/packages/core/src/js/integrations/debugsymbolicatorutils.ts b/packages/core/src/js/integrations/debugsymbolicatorutils.ts index 8f20790c09..18c595efca 100644 --- a/packages/core/src/js/integrations/debugsymbolicatorutils.ts +++ b/packages/core/src/js/integrations/debugsymbolicatorutils.ts @@ -1,5 +1,5 @@ import type { StackFrame as SentryStackFrame } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { ReactNativeLibraries } from '../utils/rnlibraries'; import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr'; import type * as ReactNative from '../vendor/react-native'; @@ -21,7 +21,7 @@ export async function fetchSourceContext(frames: SentryStackFrame[]): Promise { // Ensures native errors and crashes have the same context as JS errors NATIVE.setContext(OTA_UPDATES_CONTEXT_KEY, expoUpdates); } catch (error) { - logger.error('Error setting Expo updates context:', error); + debug.error('Error setting Expo updates context:', error); } } diff --git a/packages/core/src/js/integrations/logEnricherIntegration.ts b/packages/core/src/js/integrations/logEnricherIntegration.ts index 67b871557d..7b6b9dd786 100644 --- a/packages/core/src/js/integrations/logEnricherIntegration.ts +++ b/packages/core/src/js/integrations/logEnricherIntegration.ts @@ -1,6 +1,6 @@ /* eslint-disable complexity */ import type { Integration, Log } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import type { ReactNativeClient } from '../client'; import { NATIVE } from '../wrapper'; @@ -18,7 +18,7 @@ export const logEnricherIntegration = (): Integration => { }); }, reason => { - logger.log(reason); + debug.log(reason); }, ); }); diff --git a/packages/core/src/js/integrations/modulesloader.ts b/packages/core/src/js/integrations/modulesloader.ts index 982c8a1519..d08ec6ebc9 100644 --- a/packages/core/src/js/integrations/modulesloader.ts +++ b/packages/core/src/js/integrations/modulesloader.ts @@ -1,5 +1,5 @@ import type { Event, Integration } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'ModulesLoader'; @@ -24,7 +24,7 @@ function createProcessEvent(): (event: Event) => Promise { try { modules = await NATIVE.fetchModules(); } catch (e) { - logger.log(`Failed to get modules from native: ${e}`); + debug.log(`Failed to get modules from native: ${e}`); } isSetup = true; } diff --git a/packages/core/src/js/integrations/reactnativeerrorhandlers.ts b/packages/core/src/js/integrations/reactnativeerrorhandlers.ts index 4d91a237ac..f838717603 100644 --- a/packages/core/src/js/integrations/reactnativeerrorhandlers.ts +++ b/packages/core/src/js/integrations/reactnativeerrorhandlers.ts @@ -3,9 +3,9 @@ import { addExceptionMechanism, addGlobalUnhandledRejectionInstrumentationHandler, captureException, + debug, getClient, getCurrentScope, - logger, } from '@sentry/core'; import type { ReactNativeClientOptions } from '../options'; import { isHermesEnabled, isWeb } from '../utils/environment'; @@ -58,7 +58,7 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void { RN_GLOBAL_OBJ.HermesInternal?.enablePromiseRejectionTracker && RN_GLOBAL_OBJ?.HermesInternal?.hasPromise?.() ) { - logger.log('Using Hermes native promise rejection tracking'); + debug.log('Using Hermes native promise rejection tracking'); RN_GLOBAL_OBJ.HermesInternal.enablePromiseRejectionTracker({ allRejections: true, @@ -66,9 +66,9 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void { onHandled: promiseRejectionTrackingOptions.onHandled, }); - logger.log('Unhandled promise rejections will be caught by Sentry.'); + debug.log('Unhandled promise rejections will be caught by Sentry.'); } else if (isWeb()) { - logger.log('Using Browser JS promise rejection tracking for React Native Web'); + debug.log('Using Browser JS promise rejection tracking for React Native Web'); // Use Sentry's built-in global unhandled rejection handler addGlobalUnhandledRejectionInstrumentationHandler((error: unknown) => { @@ -85,10 +85,10 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void { checkPromiseAndWarn(); } else { // For JSC and other environments, patching was disabled by user configuration - logger.log('Unhandled promise rejections will not be caught by Sentry.'); + debug.log('Unhandled promise rejections will not be caught by Sentry.'); } } catch (e) { - logger.warn( + debug.warn( 'Failed to set up promise rejection tracking. ' + 'Unhandled promise rejections will not be caught by Sentry.' + 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.', @@ -99,7 +99,7 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void { const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = { onUnhandled: (id, error: unknown, rejection = {}) => { if (__DEV__) { - logger.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`); + debug.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`); } // Marking the rejection as handled to avoid breaking crash rate calculations. @@ -113,7 +113,7 @@ const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = { }, onHandled: id => { if (__DEV__) { - logger.warn( + debug.warn( `Promise Rejection Handled (id: ${id})\n` + 'This means you can ignore any previous messages of the form ' + `"Possible Unhandled Promise Rejection (id: ${id}):"`, @@ -137,7 +137,7 @@ function setupErrorUtilsGlobalHandler(): void { const errorUtils = RN_GLOBAL_OBJ.ErrorUtils; if (!errorUtils) { - logger.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.'); + debug.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.'); return; } @@ -149,7 +149,7 @@ function setupErrorUtilsGlobalHandler(): void { const shouldHandleFatal = isFatal && !__DEV__; if (shouldHandleFatal) { if (handlingFatal) { - logger.log('Encountered multiple fatals in a row. The latest:', error); + debug.log('Encountered multiple fatals in a row. The latest:', error); return; } handlingFatal = true; @@ -158,7 +158,7 @@ function setupErrorUtilsGlobalHandler(): void { const client = getClient(); if (!client) { - logger.error('Sentry client is missing, the error event might be lost.', error); + debug.error('Sentry client is missing, the error event might be lost.', error); // If there is no client something is fishy, anyway we call the default handler defaultHandler(error, isFatal); @@ -202,7 +202,7 @@ function setupErrorUtilsGlobalHandler(): void { defaultHandler(error, isFatal); }, (reason: unknown) => { - logger.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason); + debug.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason); }, ); }); diff --git a/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts b/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts index c7fc9690ab..9b2bb4790f 100644 --- a/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts +++ b/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { ReactNativeLibraries } from '../utils/rnlibraries'; import { RN_GLOBAL_OBJ } from '../utils/worldwide'; @@ -13,7 +13,7 @@ import { RN_GLOBAL_OBJ } from '../utils/worldwide'; */ export function polyfillPromise(): void { if (!ReactNativeLibraries.Utilities) { - logger.warn('Could not polyfill Promise. React Native Libraries Utilities not found.'); + debug.warn('Could not polyfill Promise. React Native Libraries Utilities not found.'); return; } @@ -65,7 +65,7 @@ export function checkPromiseAndWarn(): void { const UsedPromisePolyfill = getPromisePolyfill(); if (ReactNativePromise !== PromisePackagePromise) { - logger.warn( + debug.warn( 'You appear to have multiple versions of the "promise" package installed. ' + 'This may cause unexpected behavior like undefined `Promise.allSettled`. ' + 'Please install the `promise` package manually using the exact version as the React Native package. ' + @@ -75,16 +75,16 @@ export function checkPromiseAndWarn(): void { // This only make sense if the user disabled the integration Polyfill if (UsedPromisePolyfill !== RN_GLOBAL_OBJ.Promise) { - logger.warn( + debug.warn( 'Unhandled promise rejections will not be caught by Sentry. ' + 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.', ); } else { - logger.log('Unhandled promise rejections will be caught by Sentry.'); + debug.log('Unhandled promise rejections will be caught by Sentry.'); } } catch (e) { // Do Nothing - logger.warn( + debug.warn( 'Unhandled promise rejections will not be caught by Sentry. ' + 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.', ); diff --git a/packages/core/src/js/integrations/sdkinfo.ts b/packages/core/src/js/integrations/sdkinfo.ts index 9a5ba222f0..f8d54a136c 100644 --- a/packages/core/src/js/integrations/sdkinfo.ts +++ b/packages/core/src/js/integrations/sdkinfo.ts @@ -1,5 +1,5 @@ import type { Event, Integration, Package, SdkInfo as SdkInfoType } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { isExpoGo, notWeb } from '../utils/environment'; import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../version'; import { NATIVE } from '../wrapper'; @@ -40,7 +40,7 @@ async function processEvent(event: Event, fetchNativeSdkInfo: () => Promise Promise { nativeSdkPackageCache = await NATIVE.fetchNativeSdkInfo(); isCached = true; } catch (e) { - logger.warn('Could not fetch native sdk info.', e); + debug.warn('Could not fetch native sdk info.', e); } return nativeSdkPackageCache; diff --git a/packages/core/src/js/integrations/spotlight.ts b/packages/core/src/js/integrations/spotlight.ts index 44497bdec9..01f35bb819 100644 --- a/packages/core/src/js/integrations/spotlight.ts +++ b/packages/core/src/js/integrations/spotlight.ts @@ -1,5 +1,5 @@ import type { BaseTransportOptions, Client, ClientOptions, Envelope, Integration } from '@sentry/core'; -import { logger, serializeEnvelope } from '@sentry/core'; +import { debug, serializeEnvelope } from '@sentry/core'; import { ReactNativeLibraries } from '../utils/rnlibraries'; import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr'; @@ -21,7 +21,7 @@ type SpotlightReactNativeIntegrationOptions = { export function spotlightIntegration({ sidecarUrl = getDefaultSidecarUrl(), }: SpotlightReactNativeIntegrationOptions = {}): Integration { - logger.info('[Spotlight] Using Sidecar URL', sidecarUrl); + debug.log('[Spotlight] Using Sidecar URL', sidecarUrl); return { name: 'Spotlight', @@ -56,7 +56,7 @@ function sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void { const xhr = createStealthXhr(); if (!xhr) { - logger.error('[Spotlight] Sentry SDK can not create XHR object'); + debug.error('[Spotlight] Sentry SDK can not create XHR object'); return; } @@ -70,7 +70,7 @@ function sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void { // The request has been completed successfully } else { // Handle the error - logger.error( + debug.error( "[Spotlight] Sentry SDK can't connect to Spotlight is it running? See https://spotlightjs.com to download it.", new Error(xhr.statusText), ); diff --git a/packages/core/src/js/integrations/viewhierarchy.ts b/packages/core/src/js/integrations/viewhierarchy.ts index eadb618510..f05e76705f 100644 --- a/packages/core/src/js/integrations/viewhierarchy.ts +++ b/packages/core/src/js/integrations/viewhierarchy.ts @@ -1,5 +1,5 @@ import type { Attachment, Event, EventHint, Integration } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { NATIVE } from '../wrapper'; const filename: string = 'view-hierarchy.json'; @@ -29,7 +29,7 @@ async function processEvent(event: Event, hint: EventHint): Promise { try { viewHierarchy = await NATIVE.fetchViewHierarchy(); } catch (e) { - logger.error('Failed to get view hierarchy from native.', e); + debug.error('Failed to get view hierarchy from native.', e); } if (viewHierarchy) { diff --git a/packages/core/src/js/playground/modal.tsx b/packages/core/src/js/playground/modal.tsx index 847ce06883..62376bd908 100644 --- a/packages/core/src/js/playground/modal.tsx +++ b/packages/core/src/js/playground/modal.tsx @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import * as React from 'react'; import { Animated, @@ -430,9 +430,9 @@ function openURLInBrowser(url: string): void { method: 'POST', body: JSON.stringify({ url }), }).catch(e => { - logger.error('Error opening URL:', e); + debug.error('Error opening URL:', e); }); } else { - logger.error('Dev server URL not available'); + debug.error('Dev server URL not available'); } } diff --git a/packages/core/src/js/profiling/convertHermesProfile.ts b/packages/core/src/js/profiling/convertHermesProfile.ts index c84cee963e..475a68e05e 100644 --- a/packages/core/src/js/profiling/convertHermesProfile.ts +++ b/packages/core/src/js/profiling/convertHermesProfile.ts @@ -1,5 +1,5 @@ import type { FrameId, StackId, ThreadCpuFrame, ThreadCpuSample, ThreadCpuStack, ThreadId } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { MAX_PROFILE_DURATION_MS } from './constants'; import type * as Hermes from './hermes'; import { DEFAULT_BUNDLE_NAME } from './hermes'; @@ -25,7 +25,7 @@ const JS_THREAD_PRIORITY = 1; */ export function convertToSentryProfile(hermesProfile: Hermes.Profile): RawThreadCpuProfile | null { if (hermesProfile.samples.length === 0) { - logger.warn('[Profiling] No samples found in profile.'); + debug.warn('[Profiling] No samples found in profile.'); return null; } @@ -42,7 +42,7 @@ export function convertToSentryProfile(hermesProfile: Hermes.Profile): RawThread for (const sample of samples) { const sentryStackId = hermesStackToSentryStackMap.get(sample.stack_id); if (sentryStackId === undefined) { - logger.error(`[Profiling] Hermes Stack ID ${sample.stack_id} not found when mapping to Sentry Stack ID.`); + debug.error(`[Profiling] Hermes Stack ID ${sample.stack_id} not found when mapping to Sentry Stack ID.`); sample.stack_id = UNKNOWN_STACK_ID; } else { sample.stack_id = sentryStackId; @@ -87,7 +87,7 @@ export function mapSamples( const firstSample = hermesSamples[0]; if (!firstSample) { - logger.warn('[Profiling] No samples found in profile.'); + debug.warn('[Profiling] No samples found in profile.'); return { samples, hermesStacks, @@ -102,7 +102,7 @@ export function mapSamples( const elapsed_since_start_ns = (Number(hermesSample.ts) - start) * 1e3; if (elapsed_since_start_ns >= maxElapsedSinceStartNs) { - logger.warn( + debug.warn( `[Profiling] Sample has elapsed time since start ${elapsed_since_start_ns}ns ` + `greater than the max elapsed time ${maxElapsedSinceStartNs}ns.`, ); diff --git a/packages/core/src/js/profiling/debugid.ts b/packages/core/src/js/profiling/debugid.ts index a03b4db684..b73459eaf2 100644 --- a/packages/core/src/js/profiling/debugid.ts +++ b/packages/core/src/js/profiling/debugid.ts @@ -1,5 +1,5 @@ import type { DebugImage } from '@sentry/core'; -import { GLOBAL_OBJ, logger } from '@sentry/core'; +import { debug, GLOBAL_OBJ } from '@sentry/core'; import { DEFAULT_BUNDLE_NAME } from './hermes'; /** @@ -21,9 +21,7 @@ export function getDebugMetadata(): DebugImage[] { } if (debugIdsKeys.length > 1) { - logger.warn( - '[Profiling] Multiple debug images found, but only one one bundle is supported. Using the first one...', - ); + debug.warn('[Profiling] Multiple debug images found, but only one one bundle is supported. Using the first one...'); return []; } diff --git a/packages/core/src/js/profiling/integration.ts b/packages/core/src/js/profiling/integration.ts index 7564fd9de4..884f82842a 100644 --- a/packages/core/src/js/profiling/integration.ts +++ b/packages/core/src/js/profiling/integration.ts @@ -1,6 +1,6 @@ /* eslint-disable complexity */ import type { Envelope, Event, Integration, Span, ThreadCpuProfile } from '@sentry/core'; -import { getActiveSpan, getClient, logger, spanIsSampled, uuid4 } from '@sentry/core'; +import { debug, getActiveSpan, getClient, spanIsSampled, uuid4 } from '@sentry/core'; import { Platform } from 'react-native'; import type { ReactNativeClient } from '../client'; import { isHermesEnabled } from '../utils/environment'; @@ -59,7 +59,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = isReady = true; if (!isHermesEnabled()) { - logger.log('[Profiling] Hermes is not enabled, not adding profiling integration.'); + debug.log('[Profiling] Hermes is not enabled, not adding profiling integration.'); return; } @@ -81,7 +81,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = const profiledTransactions = findProfiledTransactionsFromEnvelope(envelope); if (!profiledTransactions.length) { - logger.log('[Profiling] no profiled transactions found in envelope'); + debug.log('[Profiling] no profiled transactions found in envelope'); return; } @@ -122,7 +122,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = const _shouldStartProfiling = (activeSpan: Span): boolean => { if (!spanIsSampled(activeSpan)) { - logger.log('[Profiling] Transaction is not sampled, skipping profiling'); + debug.log('[Profiling] Transaction is not sampled, skipping profiling'); return false; } @@ -132,13 +132,13 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = const profilesSampleRate = options && typeof options.profilesSampleRate === 'number' ? options.profilesSampleRate : undefined; if (profilesSampleRate === undefined) { - logger.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.'); + debug.log('[Profiling] Profiling disabled, enable it by setting `profilesSampleRate` option to SDK init call.'); return false; } // Check if we should sample this profile if (Math.random() > profilesSampleRate) { - logger.log('[Profiling] Skip profiling transaction due to sampling.'); + debug.log('[Profiling] Skip profiling transaction due to sampling.'); return false; } @@ -160,7 +160,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = startTimestampNs: profileStartTimestampNs, }; activeSpan.setAttribute('profile_id', _currentProfile.profile_id); - logger.log('[Profiling] started profiling: ', _currentProfile.profile_id); + debug.log('[Profiling] started profiling: ', _currentProfile.profile_id); }; /** @@ -172,7 +172,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = } if (span.spanContext().spanId !== _currentProfile?.span_id) { - logger.log( + debug.log( `[Profiling] Span (${span.spanContext().spanId}) ended is not the currently profiled span (${ _currentProfile?.span_id }). Not stopping profiling.`, @@ -194,14 +194,14 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = const profile = stopProfiling(_currentProfile.startTimestampNs); if (!profile) { - logger.warn('[Profiling] Stop failed. Cleaning up...'); + debug.warn('[Profiling] Stop failed. Cleaning up...'); _currentProfile = undefined; return; } PROFILE_QUEUE.add(_currentProfile.profile_id, profile); - logger.log('[Profiling] finished profiling: ', _currentProfile.profile_id); + debug.log('[Profiling] finished profiling: ', _currentProfile.profile_id); _currentProfile = undefined; }; @@ -209,7 +209,7 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = const profile_id = profiledTransaction?.contexts?.trace?.data?.profile_id; if (typeof profile_id !== 'string') { - logger.log('[Profiling] cannot find profile for a transaction without a profile context'); + debug.log('[Profiling] cannot find profile for a transaction without a profile context'); return null; } @@ -222,12 +222,12 @@ export const hermesProfilingIntegration = (initOptions: HermesProfilingOptions = PROFILE_QUEUE.delete(profile_id); if (!profile) { - logger.log(`[Profiling] cannot find profile ${profile_id} for transaction ${profiledTransaction.event_id}`); + debug.log(`[Profiling] cannot find profile ${profile_id} for transaction ${profiledTransaction.event_id}`); return null; } const profileWithEvent = enrichCombinedProfileWithEventContext(profile_id, profile, profiledTransaction); - logger.log(`[Profiling] Created profile ${profile_id} for transaction ${profiledTransaction.event_id}`); + debug.log(`[Profiling] Created profile ${profile_id} for transaction ${profiledTransaction.event_id}`); return profileWithEvent; }; diff --git a/packages/core/src/js/profiling/utils.ts b/packages/core/src/js/profiling/utils.ts index ebdc57e816..e532134244 100644 --- a/packages/core/src/js/profiling/utils.ts +++ b/packages/core/src/js/profiling/utils.ts @@ -1,6 +1,6 @@ /* eslint-disable complexity */ import type { Envelope, Event, ThreadCpuProfile } from '@sentry/core'; -import { forEachEnvelopeItem, logger } from '@sentry/core'; +import { debug, forEachEnvelopeItem } from '@sentry/core'; import { getDefaultEnvironment } from '../utils/environment'; import { getDebugMetadata } from './debugid'; import type { @@ -21,7 +21,7 @@ export function isValidProfile(profile: ThreadCpuProfile): profile is RawThreadC // Log a warning if the profile has less than 2 samples so users can know why // they are not seeing any profiling data and we cant avoid the back and forth // of asking them to provide us with a dump of the profile data. - logger.log('[Profiling] Discarding profile because it contains less than 2 samples'); + debug.log('[Profiling] Discarding profile because it contains less than 2 samples'); } return false; } @@ -81,7 +81,7 @@ export function enrichCombinedProfileWithEventContext( // warn users that this is happening if they enable debug flag if (trace_id?.length !== 32) { if (__DEV__) { - logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`); + debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`); } } diff --git a/packages/core/src/js/replay/CustomMask.tsx b/packages/core/src/js/replay/CustomMask.tsx index d3fae8382d..b293dc8060 100644 --- a/packages/core/src/js/replay/CustomMask.tsx +++ b/packages/core/src/js/replay/CustomMask.tsx @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import * as React from 'react'; import type { HostComponent, ViewProps } from 'react-native'; import { UIManager, View } from 'react-native'; @@ -37,7 +37,7 @@ const hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager const Mask = ((): HostComponent | React.ComponentType => { if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) { - logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`); + debug.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`); return MaskFallback; } @@ -50,7 +50,7 @@ const Mask = ((): HostComponent | React.ComponentType => { const Unmask = ((): HostComponent | React.ComponentType => { if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) { - logger.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`); + debug.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`); return UnmaskFallback; } diff --git a/packages/core/src/js/replay/mobilereplay.ts b/packages/core/src/js/replay/mobilereplay.ts index 75a530cc97..3530303c47 100644 --- a/packages/core/src/js/replay/mobilereplay.ts +++ b/packages/core/src/js/replay/mobilereplay.ts @@ -1,5 +1,5 @@ import type { Client, DynamicSamplingContext, Event, Integration } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { isHardCrash } from '../misc'; import { hasHooks } from '../utils/clientutils'; import { isExpoGo, notMobileOs } from '../utils/environment'; @@ -115,12 +115,12 @@ type MobileReplayIntegration = Integration & { */ export const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => { if (isExpoGo()) { - logger.warn( + debug.warn( `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \`expo prebuild\` to enable it.`, ); } if (notMobileOs()) { - logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`); + debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`); } if (isExpoGo() || notMobileOs()) { @@ -138,7 +138,7 @@ export const mobileReplayIntegration = (initOptions: MobileReplayOptions = defau const recordingReplayId = NATIVE.getCurrentReplayId(); if (recordingReplayId) { - logger.debug( + debug.log( `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`, ); return event; @@ -146,7 +146,7 @@ export const mobileReplayIntegration = (initOptions: MobileReplayOptions = defau const replayId = await NATIVE.captureReplay(isHardCrash(event)); if (!replayId) { - logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`); + debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`); return event; } diff --git a/packages/core/src/js/sdk.tsx b/packages/core/src/js/sdk.tsx index e1e35a1419..7e70ae492f 100644 --- a/packages/core/src/js/sdk.tsx +++ b/packages/core/src/js/sdk.tsx @@ -1,12 +1,12 @@ /* eslint-disable complexity */ import type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core'; import { + debug, getClient, getGlobalScope, getIntegrationsToSetup, getIsolationScope, initAndBind, - logger, makeDsn, stackParserFromStackParserOptions, withScope as coreWithScope, @@ -76,7 +76,7 @@ export function init(passedOptions: ReactNativeOptions): void { } const dsnComponents = makeDsn(dsn); if (!dsnComponents) { - logger.error('Failed to extract url from DSN: ', dsn); + debug.error('Failed to extract url from DSN: ', dsn); return undefined; } const port = dsnComponents.port ? `:${dsnComponents.port}` : ''; @@ -151,8 +151,8 @@ export function init(passedOptions: ReactNativeOptions): void { initAndBind(ReactNativeClient, options); if (isExpoGo()) { - logger.info('Offline caching, native errors features are not available in Expo Go.'); - logger.info('Use EAS Build / Native Release Build to test these features.'); + debug.log('Offline caching, native errors features are not available in Expo Go.'); + debug.log('Use EAS Build / Native Release Build to test these features.'); } } @@ -210,7 +210,7 @@ export async function flush(): Promise { // eslint-disable-next-line no-empty } catch (_) { } - logger.error('Failed to flush the event queue.'); + debug.error('Failed to flush the event queue.'); return false; } @@ -226,7 +226,7 @@ export async function close(): Promise { await client.close(); } } catch (e) { - logger.error('Failed to close the SDK'); + debug.error('Failed to close the SDK'); } } @@ -248,7 +248,7 @@ export function withScope(callback: (scope: Scope) => T): T | undefined { try { return callback(scope); } catch (e) { - logger.error('Error while running withScope callback', e); + debug.error('Error while running withScope callback', e); return undefined; } }; diff --git a/packages/core/src/js/tools/ModulesCollector.ts b/packages/core/src/js/tools/ModulesCollector.ts index 9d942d1a07..cf5b921e4e 100644 --- a/packages/core/src/js/tools/ModulesCollector.ts +++ b/packages/core/src/js/tools/ModulesCollector.ts @@ -1,8 +1,8 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'; import { posix, sep } from 'path'; -logger.enable(); +debug.enable(); // eslint-disable-next-line @typescript-eslint/unbound-method const { dirname, join, resolve, sep: posixSep } = posix; @@ -63,7 +63,7 @@ export default class ModulesCollector { version: info.version, }; } catch (error) { - logger.error(`Failed to read ${pkgPath}`); + debug.error(`Failed to read ${pkgPath}`); } return upDirSearch(); // processed package.json file, continue up search @@ -90,36 +90,36 @@ export default class ModulesCollector { collect: (sources: unknown[], modulesPaths: string[]) => Record; }>): void { if (!sourceMapPath) { - logger.error('First argument `source-map-path` is missing!'); + debug.error('First argument `source-map-path` is missing!'); return; } if (!outputModulesPath) { - logger.error('Second argument `modules-output-path` is missing!'); + debug.error('Second argument `modules-output-path` is missing!'); return; } if (!modulesPaths || modulesPaths.length === 0) { - logger.error('Third argument `modules-paths` is missing!'); + debug.error('Third argument `modules-paths` is missing!'); return; } - logger.info('Reading source map from', sourceMapPath); - logger.info('Saving modules to', outputModulesPath); - logger.info('Resolving modules from paths', modulesPaths.join(', ')); + debug.log('Reading source map from', sourceMapPath); + debug.log('Saving modules to', outputModulesPath); + debug.log('Resolving modules from paths', modulesPaths.join(', ')); if (!existsSync(sourceMapPath)) { - logger.error(`Source map file does not exist at ${sourceMapPath}`); + debug.error(`Source map file does not exist at ${sourceMapPath}`); return; } for (const modulesPath of modulesPaths) { if (!existsSync(modulesPath)) { - logger.error(`Modules path does not exist at ${modulesPath}`); + debug.error(`Modules path does not exist at ${modulesPath}`); return; } } const map: { sources?: unknown } = JSON.parse(readFileSync(sourceMapPath, 'utf8')); if (!map.sources || !Array.isArray(map.sources)) { - logger.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`); + debug.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`); return; } @@ -131,6 +131,6 @@ export default class ModulesCollector { mkdirSync(outputModulesDirPath, { recursive: true }); } writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2)); - logger.info(`Modules collected and saved to: ${outputModulesPath}`); + debug.log(`Modules collected and saved to: ${outputModulesPath}`); } } diff --git a/packages/core/src/js/tools/enableLogger.ts b/packages/core/src/js/tools/enableLogger.ts index 4dbc691916..9cd4d5be74 100644 --- a/packages/core/src/js/tools/enableLogger.ts +++ b/packages/core/src/js/tools/enableLogger.ts @@ -1,10 +1,10 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; /** * Enables debug logger when SENTRY_LOG_LEVEL=debug. */ export function enableLogger(): void { if (process.env.SENTRY_LOG_LEVEL === 'debug') { - logger.enable(); + debug.enable(); } } diff --git a/packages/core/src/js/tools/metroMiddleware.ts b/packages/core/src/js/tools/metroMiddleware.ts index aba23971a6..66b9e6157d 100644 --- a/packages/core/src/js/tools/metroMiddleware.ts +++ b/packages/core/src/js/tools/metroMiddleware.ts @@ -1,5 +1,5 @@ import type { StackFrame } from '@sentry/core'; -import { addContextToFrame, logger } from '@sentry/core'; +import { addContextToFrame, debug } from '@sentry/core'; import { readFile } from 'fs'; import type { IncomingMessage, ServerResponse } from 'http'; import type { InputConfigT, Middleware } from 'metro-config'; @@ -15,7 +15,7 @@ export const stackFramesContextMiddleware: Middleware = async ( request: IncomingMessage, response: ServerResponse, ): Promise => { - logger.debug('[@sentry/react-native/metro] Received request for stack frames context.'); + debug.log('[@sentry/react-native/metro] Received request for stack frames context.'); request.setEncoding('utf8'); const rawBody = await getRawBody(request); @@ -25,14 +25,14 @@ export const stackFramesContextMiddleware: Middleware = async ( try { body = JSON.parse(rawBody); } catch (e) { - logger.debug('[@sentry/react-native/metro] Could not parse request body.', e); + debug.log('[@sentry/react-native/metro] Could not parse request body.', e); badRequest(response, 'Invalid request body. Expected a JSON object.'); return; } const stack = body.stack; if (!Array.isArray(stack)) { - logger.debug('[@sentry/react-native/metro] Invalid stack frames.', stack); + debug.log('[@sentry/react-native/metro] Invalid stack frames.', stack); badRequest(response, 'Invalid stack frames. Expected an array.'); return; } @@ -41,7 +41,7 @@ export const stackFramesContextMiddleware: Middleware = async ( response.setHeader('Content-Type', 'application/json'); response.statusCode = 200; response.end(JSON.stringify({ stack: stackWithSourceContext })); - logger.debug('[@sentry/react-native/metro] Sent stack frames context.'); + debug.log('[@sentry/react-native/metro] Sent stack frames context.'); }; async function addSourceContext(frame: StackFrame): Promise { @@ -51,7 +51,7 @@ async function addSourceContext(frame: StackFrame): Promise { try { if (typeof frame.filename !== 'string') { - logger.warn('[@sentry/react-native/metro] Could not read source context for frame without filename.'); + debug.warn('[@sentry/react-native/metro] Could not read source context for frame without filename.'); return frame; } @@ -59,7 +59,7 @@ async function addSourceContext(frame: StackFrame): Promise { const lines = source.split('\n'); addContextToFrame(lines, frame); } catch (error) { - logger.warn('[@sentry/react-native/metro] Could not read source context for frame.', error); + debug.warn('[@sentry/react-native/metro] Could not read source context for frame.', error); } return frame; } diff --git a/packages/core/src/js/tools/metroconfig.ts b/packages/core/src/js/tools/metroconfig.ts index c2e41dd579..64897eea1b 100644 --- a/packages/core/src/js/tools/metroconfig.ts +++ b/packages/core/src/js/tools/metroconfig.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro'; import type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver'; import * as process from 'process'; @@ -150,7 +150,7 @@ export function withSentryBabelTransformer( annotateReactComponents: true | { ignoredComponents?: string[] }, ): MetroConfig { const defaultBabelTransformerPath = config.transformer?.babelTransformerPath; - logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath); + debug.log('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath); if (!defaultBabelTransformerPath) { // This has to be console.warn because the options is enabled but won't be used @@ -272,7 +272,7 @@ export function withSentryFramesCollapsed(config: MetroConfig): MetroConfig { const collapseSentryInternalFrames = (frame: MetroFrame): boolean => typeof frame.file === 'string' && (frame.file.includes('node_modules/@sentry/core/cjs/instrument.js') || - frame.file.includes('node_modules/@sentry/core/cjs/logger.js')); + frame.file.includes('node_modules/@sentry/core/cjs/debug.js')); const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => { const originalOrSentryCustomizeFrame = ( diff --git a/packages/core/src/js/tools/sentryBabelTransformerUtils.ts b/packages/core/src/js/tools/sentryBabelTransformerUtils.ts index 892e907291..6c77f42aef 100644 --- a/packages/core/src/js/tools/sentryBabelTransformerUtils.ts +++ b/packages/core/src/js/tools/sentryBabelTransformerUtils.ts @@ -1,5 +1,5 @@ import componentAnnotatePlugin from '@sentry/babel-plugin-component-annotate'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import * as process from 'process'; import type { BabelTransformer, BabelTransformerArgs } from './vendor/metro/metroBabelTransformer'; @@ -13,7 +13,7 @@ export const SENTRY_BABEL_TRANSFORMER_OPTIONS = 'SENTRY_BABEL_TRANSFORMER_OPTION */ export function setSentryDefaultBabelTransformerPathEnv(defaultBabelTransformerPath: string): void { process.env[SENTRY_DEFAULT_BABEL_TRANSFORMER_PATH] = defaultBabelTransformerPath; - logger.debug(`Saved default Babel transformer path ${defaultBabelTransformerPath}`); + debug.log(`Saved default Babel transformer path ${defaultBabelTransformerPath}`); } /** @@ -34,7 +34,7 @@ export function loadDefaultBabelTransformer(): BabelTransformer { ); } - logger.debug(`Loading default Babel transformer from ${defaultBabelTransformerPath}`); + debug.log(`Loading default Babel transformer from ${defaultBabelTransformerPath}`); // eslint-disable-next-line @typescript-eslint/no-var-requires return require(defaultBabelTransformerPath); } @@ -45,7 +45,7 @@ export function loadDefaultBabelTransformer(): BabelTransformer { export function setSentryBabelTransformerOptions(options: SentryBabelTransformerOptions): void { let optionsString: string | null = null; try { - logger.debug('Stringifying Sentry Babel transformer options', options); + debug.log('Stringifying Sentry Babel transformer options', options); optionsString = JSON.stringify(options); } catch (e) { // eslint-disable-next-line no-console @@ -56,7 +56,7 @@ export function setSentryBabelTransformerOptions(options: SentryBabelTransformer return; } - logger.debug(`Sentry Babel transformer options set to ${SENTRY_BABEL_TRANSFORMER_OPTIONS}`, optionsString); + debug.log(`Sentry Babel transformer options set to ${SENTRY_BABEL_TRANSFORMER_OPTIONS}`, optionsString); process.env[SENTRY_BABEL_TRANSFORMER_OPTIONS] = optionsString; } @@ -66,14 +66,12 @@ export function setSentryBabelTransformerOptions(options: SentryBabelTransformer export function getSentryBabelTransformerOptions(): SentryBabelTransformerOptions | undefined { const optionsString = process.env[SENTRY_BABEL_TRANSFORMER_OPTIONS]; if (!optionsString) { - logger.debug( - `Sentry Babel transformer options environment variable ${SENTRY_BABEL_TRANSFORMER_OPTIONS} is not set`, - ); + debug.log(`Sentry Babel transformer options environment variable ${SENTRY_BABEL_TRANSFORMER_OPTIONS} is not set`); return undefined; } try { - logger.debug(`Parsing Sentry Babel transformer options from ${optionsString}`); + debug.log(`Parsing Sentry Babel transformer options from ${optionsString}`); return JSON.parse(optionsString); } catch (e) { // eslint-disable-next-line no-console diff --git a/packages/core/src/js/touchevents.tsx b/packages/core/src/js/touchevents.tsx index a9fd41852f..aaf541dad1 100644 --- a/packages/core/src/js/touchevents.tsx +++ b/packages/core/src/js/touchevents.tsx @@ -1,5 +1,5 @@ import type { SeverityLevel } from '@sentry/core'; -import { addBreadcrumb, dropUndefinedKeys, getClient, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { addBreadcrumb, debug, dropUndefinedKeys, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as React from 'react'; import type { GestureResponderEvent } from 'react-native'; import { StyleSheet, View } from 'react-native'; @@ -121,7 +121,7 @@ class TouchEventBoundary extends React.Component { const root = touchPath[0]; if (!root) { - logger.warn('[TouchEvents] No root component found in touch path.'); + debug.warn('[TouchEvents] No root component found in touch path.'); return; } @@ -135,7 +135,7 @@ class TouchEventBoundary extends React.Component { }; addBreadcrumb(crumb); - logger.log(`[TouchEvents] ${crumb.message}`); + debug.log(`[TouchEvents] ${crumb.message}`); } /** diff --git a/packages/core/src/js/tracing/gesturetracing.ts b/packages/core/src/js/tracing/gesturetracing.ts index 8cf0a329f8..67be06d644 100644 --- a/packages/core/src/js/tracing/gesturetracing.ts +++ b/packages/core/src/js/tracing/gesturetracing.ts @@ -1,5 +1,5 @@ import type { Breadcrumb } from '@sentry/core'; -import { addBreadcrumb, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { addBreadcrumb, debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { startUserInteractionSpan } from './integrations/userInteraction'; import { UI_ACTION } from './ops'; import { SPAN_ORIGIN_AUTO_INTERACTION } from './origin'; @@ -46,17 +46,17 @@ export function sentryTraceGesture( ): GestureT { const gestureCandidate = gesture as unknown as BaseGesture | undefined | null; if (!gestureCandidate) { - logger.warn('[GestureTracing] Gesture can not be undefined'); + debug.warn('[GestureTracing] Gesture can not be undefined'); return gesture; } if (!gestureCandidate.handlers) { - logger.warn( + debug.warn( '[GestureTracing] Can not wrap gesture without handlers. If you want to wrap a gesture composition wrap individual gestures.', ); return gesture; } if (!label) { - logger.warn('[GestureTracing] Can not wrap gesture without name.'); + debug.warn('[GestureTracing] Can not wrap gesture without name.'); return gesture; } const name = @@ -122,7 +122,7 @@ function addGestureBreadcrumb( addBreadcrumb(crumb); - logger.log(`[GestureTracing] ${crumb.message}`); + debug.log(`[GestureTracing] ${crumb.message}`); } /** diff --git a/packages/core/src/js/tracing/integrations/appStart.ts b/packages/core/src/js/tracing/integrations/appStart.ts index 5af3d5a8a5..181737b188 100644 --- a/packages/core/src/js/tracing/integrations/appStart.ts +++ b/packages/core/src/js/tracing/integrations/appStart.ts @@ -1,10 +1,10 @@ /* eslint-disable complexity, max-lines */ import type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core'; import { + debug, getCapturedScopesOnSpan, getClient, getCurrentScope, - logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, startInactiveSpan, @@ -75,7 +75,7 @@ export function captureAppStart(): Promise { export async function _captureAppStart({ isManual }: { isManual: boolean }): Promise { const client = getClient(); if (!client) { - logger.warn('[AppStart] Could not capture App Start, missing client.'); + debug.warn('[AppStart] Could not capture App Start, missing client.'); return; } @@ -87,9 +87,9 @@ export async function _captureAppStart({ isManual }: { isManual: boolean }): Pro if (NATIVE.enableNative) { try { endFrames = await NATIVE.fetchNativeFrames(); - logger.debug('[AppStart] Captured end frames for app start.', endFrames); + debug.log('[AppStart] Captured end frames for app start.', endFrames); } catch (error) { - logger.debug('[AppStart] Failed to capture end frames for app start.', error); + debug.log('[AppStart] Failed to capture end frames for app start.', error); } } @@ -106,8 +106,8 @@ export async function _captureAppStart({ isManual }: { isManual: boolean }): Pro * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`. */ export function setRootComponentCreationTimestampMs(timestampMs: number): void { - appStartEndData?.timestampMs && logger.warn('Setting Root component creation timestamp after app start end is set.'); - rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.'); + appStartEndData?.timestampMs && debug.warn('Setting Root component creation timestamp after app start end is set.'); + rootComponentCreationTimestampMs && debug.warn('Overwriting already set root component creation timestamp.'); rootComponentCreationTimestampMs = timestampMs; isRootComponentCreationTimestampMsManual = true; } @@ -128,7 +128,7 @@ export function _setRootComponentCreationTimestampMs(timestampMs: number): void * @private */ export const _setAppStartEndData = (data: AppStartEndData): void => { - appStartEndData && logger.warn('Overwriting already set app start end data.'); + appStartEndData && debug.warn('Overwriting already set app start end data.'); appStartEndData = data; }; @@ -146,7 +146,7 @@ export function _clearRootComponentCreationTimestampMs(): void { */ function attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): void { if (frames.totalFrames <= 0 && frames.slowFrames <= 0 && frames.totalFrames <= 0) { - logger.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`); + debug.warn(`[AppStart] Detected zero slow or frozen frames. Not adding measurements to spanId (${span.span_id}).`); return; } span.data = span.data || {}; @@ -154,7 +154,7 @@ function attachFrameDataToSpan(span: SpanJSON, frames: NativeFramesResponse): vo span.data['frames.slow'] = frames.slowFrames; span.data['frames.frozen'] = frames.frozenFrames; - logger.debug('[AppStart] Attached frame data to span.', { + debug.log('[AppStart] Attached frame data to span.', { spanId: span.span_id, frameData: { total: frames.totalFrames, @@ -190,7 +190,7 @@ export const appStartIntegration = ({ if (!enableAppStartTracking) { isEnabled = false; - logger.warn('[AppStart] App start tracking is disabled.'); + debug.warn('[AppStart] App start tracking is disabled.'); } client.on('spanStart', recordFirstStartedActiveRootSpanId); @@ -206,11 +206,11 @@ export const appStartIntegration = ({ getAppRegistryIntegration(client)?.onRunApplication(() => { if (appStartDataFlushed) { - logger.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.'); + debug.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.'); appStartDataFlushed = false; firstStartedActiveRootSpanId = undefined; } else { - logger.log( + debug.log( '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.', ); } @@ -250,7 +250,7 @@ export const appStartIntegration = ({ */ const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => { firstStartedActiveRootSpanId = spanId; - logger.debug('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId); + debug.log('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId); }; async function captureStandaloneAppStart(): Promise { @@ -262,18 +262,18 @@ export const appStartIntegration = ({ } if (!standalone) { - logger.debug( + debug.log( '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.', ); return; } - logger.debug('[AppStart] App start tracking standalone root span (transaction).'); + debug.log('[AppStart] App start tracking standalone root span (transaction).'); if (!appStartEndData?.endFrames && NATIVE.enableNative) { try { const endFrames = await NATIVE.fetchNativeFrames(); - logger.debug('[AppStart] Captured end frames for standalone app start.', endFrames); + debug.log('[AppStart] Captured end frames for standalone app start.', endFrames); const currentTimestamp = appStartEndData?.timestampMs || timestampInSeconds() * 1000; _setAppStartEndData({ @@ -281,7 +281,7 @@ export const appStartIntegration = ({ endFrames, }); } catch (error) { - logger.debug('[AppStart] Failed to capture frames for standalone app start.', error); + debug.log('[AppStart] Failed to capture frames for standalone app start.', error); } } @@ -300,7 +300,7 @@ export const appStartIntegration = ({ const event = convertSpanToTransaction(span); if (!event) { - logger.warn('[AppStart] Failed to convert App Start span to transaction.'); + debug.warn('[AppStart] Failed to convert App Start span to transaction.'); return; } @@ -321,17 +321,17 @@ export const appStartIntegration = ({ } if (!firstStartedActiveRootSpanId) { - logger.warn('[AppStart] No first started active root span id recorded. Can not attach app start.'); + debug.warn('[AppStart] No first started active root span id recorded. Can not attach app start.'); return; } if (!event.contexts?.trace) { - logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.'); + debug.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.'); return; } if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) { - logger.warn( + debug.warn( '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.', ); return; @@ -339,23 +339,23 @@ export const appStartIntegration = ({ const appStart = await NATIVE.fetchNativeAppStart(); if (!appStart) { - logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.'); + debug.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.'); return; } if (appStart.has_fetched) { - logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.'); + debug.warn('[AppStart] Measured app start metrics were already reported from the native layer.'); return; } const appStartTimestampMs = appStart.app_start_timestamp_ms; if (!appStartTimestampMs) { - logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.'); + debug.warn('[AppStart] App start timestamp could not be loaded from the native layer.'); return; } const appStartEndTimestampMs = appStartEndData?.timestampMs || getBundleStartTimestampMs(); if (!appStartEndTimestampMs) { - logger.warn( + debug.warn( '[AppStart] Javascript failed to record app start end. `_setAppStartEndData` was not called nor could the bundle start be found.', ); return; @@ -364,14 +364,14 @@ export const appStartIntegration = ({ const isAppStartWithinBounds = !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS; if (!__DEV__ && !isAppStartWithinBounds) { - logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.'); + debug.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.'); return; } const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs; if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) { // Dev builds can have long app start waiting over minute for the first bundle to be produced - logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.'); + debug.warn('[AppStart] App start duration is over a minute long, not adding app start span.'); return; } @@ -379,7 +379,7 @@ export const appStartIntegration = ({ // This can happen when MainActivity on Android is recreated, // and the app start end timestamp is not updated, for example // due to missing `Sentry.wrap(RootComponent)` call. - logger.warn( + debug.warn( '[AppStart] Last recorded app start end timestamp is before the app start timestamp.', 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.', ); @@ -417,7 +417,7 @@ export const appStartIntegration = ({ const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000; if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) { - logger.debug( + debug.log( '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.', ); event.timestamp = appStartEndTimestampSeconds; @@ -447,7 +447,7 @@ export const appStartIntegration = ({ ]; children.push(...appStartSpans); - logger.debug('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2)); + debug.log('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2)); const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT; const measurementValue = { @@ -456,7 +456,7 @@ export const appStartIntegration = ({ }; event.measurements = event.measurements || {}; event.measurements[measurementKey] = measurementValue; - logger.debug( + debug.log( '[AppStart] Added app start measurement to transaction event.', JSON.stringify(measurementValue, undefined, 2), ); @@ -474,7 +474,7 @@ export const appStartIntegration = ({ function setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void { if (!span.timestamp || !span.start_timestamp) { - logger.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.'); + debug.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.'); return; } @@ -499,12 +499,12 @@ function createJSExecutionStartSpan( const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000; if (bundleStartTimestampSeconds < parentSpan.start_timestamp) { - logger.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.'); + debug.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.'); return undefined; } if (!rootComponentCreationTimestampMs) { - logger.warn('Missing the root component first constructor call timestamp.'); + debug.warn('Missing the root component first constructor call timestamp.'); return createChildSpanJSON(parentSpan, { description: 'JS Bundle Execution Start', start_timestamp: bundleStartTimestampSeconds, diff --git a/packages/core/src/js/tracing/integrations/nativeFrames.ts b/packages/core/src/js/tracing/integrations/nativeFrames.ts index 07093e4ba2..58de636e0a 100644 --- a/packages/core/src/js/tracing/integrations/nativeFrames.ts +++ b/packages/core/src/js/tracing/integrations/nativeFrames.ts @@ -1,5 +1,5 @@ import type { Client, Event, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core'; -import { logger, timestampInSeconds } from '@sentry/core'; +import { debug, timestampInSeconds } from '@sentry/core'; import type { NativeFramesResponse } from '../../NativeRNSentry'; import { AsyncExpiringMap } from '../../utils/AsyncExpiringMap'; import { isRootSpan } from '../../utils/span'; @@ -70,7 +70,7 @@ export const nativeFramesIntegration = (): Integration => { */ const setup = (client: Client): void => { if (!NATIVE.enableNative) { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] This is not available on the Web, Expo Go and other platforms without native modules.`, ); return undefined; @@ -87,14 +87,14 @@ export const nativeFramesIntegration = (): Integration => { } const spanId = rootSpan.spanContext().spanId; - logger.debug(`[${INTEGRATION_NAME}] Fetching frames for root span start (${spanId}).`); + debug.log(`[${INTEGRATION_NAME}] Fetching frames for root span start (${spanId}).`); _spanToNativeFramesAtStartMap.set( spanId, new Promise(resolve => { fetchNativeFrames() .then(frames => resolve(frames)) .then(undefined, error => { - logger.debug(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error); + debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error); resolve(null); }); }), @@ -112,7 +112,7 @@ export const nativeFramesIntegration = (): Integration => { return; } - logger.debug(`[${INTEGRATION_NAME}] Fetch frames for root span end (${spanId}).`); + debug.log(`[${INTEGRATION_NAME}] Fetch frames for root span end (${spanId}).`); _spanToNativeFramesAtEndMap.set( spanId, new Promise(resolve => { @@ -124,14 +124,14 @@ export const nativeFramesIntegration = (): Integration => { }); }) .then(undefined, error => { - logger.debug(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error); + debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error); resolve(null); }); }), ); return undefined; } else { - logger.debug(`[${INTEGRATION_NAME}] Fetch frames for child span end (${spanId}).`); + debug.log(`[${INTEGRATION_NAME}] Fetch frames for child span end (${spanId}).`); fetchNativeFrames() .then(frames => { _lastChildSpanEndFrames = { @@ -139,7 +139,7 @@ export const nativeFramesIntegration = (): Integration => { nativeFrames: frames, }; }) - .catch(error => logger.debug(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error)); + .catch(error => debug.log(`[${INTEGRATION_NAME}] Error while fetching native frames.`, error)); } }; @@ -159,7 +159,7 @@ export const nativeFramesIntegration = (): Integration => { const spanId = event.contexts.trace.span_id; const startFrames = await _spanToNativeFramesAtStartMap.pop(spanId); if (!startFrames) { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] Start frames of transaction ${event.transaction} (eventId, ${event.event_id}) are missing, but the transaction already ended.`, ); return event; @@ -170,15 +170,15 @@ export const nativeFramesIntegration = (): Integration => { if (endFrames && isClose(endFrames.timestamp, event.timestamp)) { // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp) - logger.debug(`[${INTEGRATION_NAME}] Using frames from root span end (spanId, ${spanId}).`); + debug.log(`[${INTEGRATION_NAME}] Using frames from root span end (spanId, ${spanId}).`); finalEndFrames = endFrames.nativeFrames; } else if (_lastChildSpanEndFrames && isClose(_lastChildSpanEndFrames.timestamp, event.timestamp)) { // Fallback to the last span finish if it is within the margin of error of the actual finish timestamp. // This should be the case for trimEnd. - logger.debug(`[${INTEGRATION_NAME}] Using native frames from last child span end (spanId, ${spanId}).`); + debug.log(`[${INTEGRATION_NAME}] Using native frames from last child span end (spanId, ${spanId}).`); finalEndFrames = _lastChildSpanEndFrames.nativeFrames; } else { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] Frames were collected within larger than margin of error delay for spanId (${spanId}). Dropping the inaccurate values.`, ); return event; @@ -204,13 +204,13 @@ export const nativeFramesIntegration = (): Integration => { measurements.frames_slow.value <= 0 && measurements.frames_total.value <= 0 ) { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] Detected zero slow or frozen frames. Not adding measurements to spanId (${spanId}).`, ); return event; } - logger.log( + debug.log( `[${INTEGRATION_NAME}] Adding measurements to ${traceOp} transaction ${event.transaction}: ${JSON.stringify( measurements, undefined, diff --git a/packages/core/src/js/tracing/integrations/stalltracking.ts b/packages/core/src/js/tracing/integrations/stalltracking.ts index f0d6c96eaf..288218696b 100644 --- a/packages/core/src/js/tracing/integrations/stalltracking.ts +++ b/packages/core/src/js/tracing/integrations/stalltracking.ts @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ import type { Client, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core'; -import { getRootSpan, logger, spanToJSON, timestampInSeconds } from '@sentry/core'; +import { debug, getRootSpan, spanToJSON, timestampInSeconds } from '@sentry/core'; import type { AppStateStatus } from 'react-native'; import { AppState } from 'react-native'; import { STALL_COUNT, STALL_LONGEST_TIME, STALL_TOTAL_TIME } from '../../measurements'; @@ -124,7 +124,7 @@ export const stallTrackingIntegration = ({ } if (statsByRootSpan.has(rootSpan)) { - logger.error( + debug.error( '[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost.', ); return; @@ -148,7 +148,7 @@ export const stallTrackingIntegration = ({ if (!transactionStats) { // Transaction has been flushed out somehow, we return null. - logger.log('[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.'); + debug.log('[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.'); statsByRootSpan.delete(rootSpan); _shouldStopTracking(); @@ -169,13 +169,13 @@ export const stallTrackingIntegration = ({ const latestChildSpanEnd = getLatestChildSpanEndTimestamp(rootSpan); if (latestChildSpanEnd !== endTimestamp) { - logger.log( + debug.log( '[StallTracking] Stall measurements not added due to a custom `endTimestamp` (root end is not equal to the latest child span end).', ); } if (!transactionStats.atTimestamp) { - logger.log( + debug.log( '[StallTracking] Stall measurements not added due to `endTimestamp` not being close to now. And no previous stats from child end were found.', ); } @@ -190,7 +190,7 @@ export const stallTrackingIntegration = ({ if (!statsOnFinish) { if (typeof endTimestamp !== 'undefined') { - logger.log( + debug.log( '[StallTracking] Stall measurements not added due to `endTimestamp` not being close to now.', 'endTimestamp', endTimestamp, @@ -240,7 +240,7 @@ export const stallTrackingIntegration = ({ const previousStats = statsByRootSpan.get(rootSpan); if (previousStats) { if (Math.abs(timestampInSeconds() - childSpanEndTime) > MARGIN_OF_ERROR_SECONDS) { - logger.log( + debug.log( '[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now.', ); diff --git a/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts b/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts index d1349708ec..92b38370df 100644 --- a/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts +++ b/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts @@ -1,5 +1,5 @@ import type { Event, Integration, SpanJSON } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { NATIVE } from '../../wrapper'; import { UI_LOAD_FULL_DISPLAY, UI_LOAD_INITIAL_DISPLAY } from '../ops'; import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from '../origin'; @@ -31,14 +31,14 @@ export const timeToDisplayIntegration = (): Integration => { const rootSpanId = event.contexts?.trace?.span_id; if (!rootSpanId) { - logger.warn(`[${INTEGRATION_NAME}] No root span id found in transaction.`); + debug.warn(`[${INTEGRATION_NAME}] No root span id found in transaction.`); return event; } const transactionStartTimestampSeconds = event.start_timestamp; if (!transactionStartTimestampSeconds) { // This should never happen - logger.warn(`[${INTEGRATION_NAME}] No transaction start timestamp found in transaction.`); + debug.warn(`[${INTEGRATION_NAME}] No transaction start timestamp found in transaction.`); return event; } @@ -106,12 +106,12 @@ async function addTimeToInitialDisplay({ let ttidSpan: SpanJSON | undefined = event.spans?.find(span => span.op === UI_LOAD_INITIAL_DISPLAY); if (ttidSpan && (ttidSpan.status === undefined || ttidSpan.status === 'ok') && !ttidEndTimestampSeconds) { - logger.debug(`[${INTEGRATION_NAME}] Ttid span already exists and is ok.`, ttidSpan); + debug.log(`[${INTEGRATION_NAME}] Ttid span already exists and is ok.`, ttidSpan); return ttidSpan; } if (!ttidEndTimestampSeconds) { - logger.debug(`[${INTEGRATION_NAME}] No manual ttid end timestamp found for span ${rootSpanId}.`); + debug.log(`[${INTEGRATION_NAME}] No manual ttid end timestamp found for span ${rootSpanId}.`); return addAutomaticTimeToInitialDisplay({ event, rootSpanId, @@ -123,7 +123,7 @@ async function addTimeToInitialDisplay({ if (ttidSpan?.status && ttidSpan.status !== 'ok') { ttidSpan.status = 'ok'; ttidSpan.timestamp = ttidEndTimestampSeconds; - logger.debug(`[${INTEGRATION_NAME}] Updated existing ttid span.`, ttidSpan); + debug.log(`[${INTEGRATION_NAME}] Updated existing ttid span.`, ttidSpan); return ttidSpan; } @@ -138,7 +138,7 @@ async function addTimeToInitialDisplay({ [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, }, }); - logger.debug(`[${INTEGRATION_NAME}] Added ttid span to transaction.`, ttidSpan); + debug.log(`[${INTEGRATION_NAME}] Added ttid span to transaction.`, ttidSpan); event.spans.push(ttidSpan); return ttidSpan; } @@ -159,7 +159,7 @@ async function addAutomaticTimeToInitialDisplay({ const hasBeenSeen = event.contexts?.trace?.data?.[SEMANTIC_ATTRIBUTE_ROUTE_HAS_BEEN_SEEN]; if (hasBeenSeen && !enableTimeToInitialDisplayForPreloadedRoutes) { - logger.debug( + debug.log( `[${INTEGRATION_NAME}] Route has been seen and time to initial display is disabled for preloaded routes.`, ); return undefined; @@ -167,7 +167,7 @@ async function addAutomaticTimeToInitialDisplay({ const ttidTimestampSeconds = ttidNativeTimestampSeconds ?? ttidFallbackTimestampSeconds; if (!ttidTimestampSeconds) { - logger.debug(`[${INTEGRATION_NAME}] No automatic ttid end timestamp found for span ${rootSpanId}.`); + debug.log(`[${INTEGRATION_NAME}] No automatic ttid end timestamp found for span ${rootSpanId}.`); return undefined; } @@ -222,7 +222,7 @@ async function addTimeToFullDisplay({ if (ttfdSpan?.status && ttfdSpan.status !== 'ok') { ttfdSpan.status = 'ok'; ttfdSpan.timestamp = ttfdAdjustedEndTimestampSeconds; - logger.debug(`[${INTEGRATION_NAME}] Updated existing ttfd span.`, ttfdSpan); + debug.log(`[${INTEGRATION_NAME}] Updated existing ttfd span.`, ttfdSpan); return ttfdSpan; } @@ -238,7 +238,7 @@ async function addTimeToFullDisplay({ [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, }, }); - logger.debug(`[${INTEGRATION_NAME}] Added ttfd span to transaction.`, ttfdSpan); + debug.log(`[${INTEGRATION_NAME}] Added ttfd span to transaction.`, ttfdSpan); event.spans.push(ttfdSpan); return ttfdSpan; } diff --git a/packages/core/src/js/tracing/integrations/userInteraction.ts b/packages/core/src/js/tracing/integrations/userInteraction.ts index a42f71d62e..3be486735c 100644 --- a/packages/core/src/js/tracing/integrations/userInteraction.ts +++ b/packages/core/src/js/tracing/integrations/userInteraction.ts @@ -1,9 +1,9 @@ import type { Integration, Span, StartSpanOptions } from '@sentry/core'; import { + debug, getActiveSpan, getClient, getCurrentScope, - logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; @@ -36,29 +36,29 @@ export const startUserInteractionSpan = (userInteractionId: { const tracing = getCurrentReactNativeTracingIntegration(); if (!tracing) { - logger.log(`[${INTEGRATION_NAME}] Tracing integration is not available. Can not start user interaction span.`); + debug.log(`[${INTEGRATION_NAME}] Tracing integration is not available. Can not start user interaction span.`); return undefined; } const options = client.getOptions() as ReactNativeClientOptions; const { elementId, op } = userInteractionId; if (!options.enableUserInteractionTracing) { - logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing is disabled.`); + debug.log(`[${INTEGRATION_NAME}] User Interaction Tracing is disabled.`); return undefined; } if (!elementId) { - logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction with undefined elementId.`); + debug.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction with undefined elementId.`); return undefined; } if (!tracing.state.currentRoute) { - logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction without a current route.`); + debug.log(`[${INTEGRATION_NAME}] User Interaction Tracing can not create transaction without a current route.`); return undefined; } const activeTransaction = getActiveSpan(); const activeTransactionIsNotInteraction = activeTransaction && !isSentryInteractionSpan(activeTransaction); if (activeTransaction && activeTransactionIsNotInteraction) { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] Did not create ${op} transaction because active transaction ${ spanToJSON(activeTransaction).description } exists on the scope.`, @@ -72,7 +72,7 @@ export const startUserInteractionSpan = (userInteractionId: { spanToJSON(activeTransaction).description === name && spanToJSON(activeTransaction).op === op ) { - logger.warn( + debug.warn( `[${INTEGRATION_NAME}] Did not create ${op} transaction because it the same transaction ${ spanToJSON(activeTransaction).description } already exists on the scope.`, @@ -93,6 +93,6 @@ export const startUserInteractionSpan = (userInteractionId: { }); newSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_INTERACTION); onlySampleIfChildSpans(client, newSpan); - logger.log(`[${INTEGRATION_NAME}] User Interaction Tracing Created ${op} transaction ${name}.`); + debug.log(`[${INTEGRATION_NAME}] User Interaction Tracing Created ${op} transaction ${name}.`); return newSpan; }; diff --git a/packages/core/src/js/tracing/onSpanEndUtils.ts b/packages/core/src/js/tracing/onSpanEndUtils.ts index d63913e69f..d35d9e7379 100644 --- a/packages/core/src/js/tracing/onSpanEndUtils.ts +++ b/packages/core/src/js/tracing/onSpanEndUtils.ts @@ -1,5 +1,5 @@ import type { Client, Span } from '@sentry/core'; -import { getSpanDescendants, logger, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core'; +import { debug, getSpanDescendants, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core'; import type { AppStateStatus } from 'react-native'; import { AppState } from 'react-native'; import { isRootSpan, isSentrySpan } from '../utils/span'; @@ -18,7 +18,7 @@ export function onThisSpanEnd(client: Client, span: Span, callback: (span: Span) export const adjustTransactionDuration = (client: Client, span: Span, maxDurationMs: number): void => { if (!isRootSpan(span)) { - logger.warn('Not sampling empty back spans only works for Sentry Transactions (Root Spans).'); + debug.warn('Not sampling empty back spans only works for Sentry Transactions (Root Spans).'); return; } @@ -45,17 +45,17 @@ export const adjustTransactionDuration = (client: Client, span: Span, maxDuratio export const ignoreEmptyBackNavigation = (client: Client | undefined, span: Span | undefined): void => { if (!client) { - logger.warn('Could not hook on spanEnd event because client is not defined.'); + debug.warn('Could not hook on spanEnd event because client is not defined.'); return; } if (!span) { - logger.warn('Could not hook on spanEnd event because span is not defined.'); + debug.warn('Could not hook on spanEnd event because span is not defined.'); return; } if (!isRootSpan(span) || !isSentrySpan(span)) { - logger.warn('Not sampling empty back spans only works for Sentry Transactions (Root Spans).'); + debug.warn('Not sampling empty back spans only works for Sentry Transactions (Root Spans).'); return; } @@ -78,7 +78,7 @@ export const ignoreEmptyBackNavigation = (client: Client | undefined, span: Span if (filtered.length <= 0) { // filter children must include at least one span not created by the navigation automatic instrumentation - logger.log( + debug.log( 'Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.', ); // Route has been seen before and has no child spans. @@ -93,7 +93,7 @@ export const ignoreEmptyBackNavigation = (client: Client | undefined, span: Span */ export const onlySampleIfChildSpans = (client: Client, span: Span): void => { if (!isRootSpan(span) || !isSentrySpan(span)) { - logger.warn('Not sampling childless spans only works for Sentry Transactions (Root Spans).'); + debug.warn('Not sampling childless spans only works for Sentry Transactions (Root Spans).'); return; } @@ -106,7 +106,7 @@ export const onlySampleIfChildSpans = (client: Client, span: Span): void => { if (children.length <= 1) { // Span always has at lest one child, itself - logger.log(`Not sampling as ${spanToJSON(span).op} transaction has no child spans.`); + debug.log(`Not sampling as ${spanToJSON(span).op} transaction has no child spans.`); span['_sampled'] = false; } }); @@ -118,7 +118,7 @@ export const onlySampleIfChildSpans = (client: Client, span: Span): void => { export const cancelInBackground = (client: Client, span: Span): void => { const subscription = AppState.addEventListener('change', (newState: AppStateStatus) => { if (newState === 'background') { - logger.debug(`Setting ${spanToJSON(span).op} transaction to cancelled because the app is in the background.`); + debug.log(`Setting ${spanToJSON(span).op} transaction to cancelled because the app is in the background.`); span.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' }); span.end(); } @@ -127,7 +127,7 @@ export const cancelInBackground = (client: Client, span: Span): void => { subscription && client.on('spanEnd', (endedSpan: Span) => { if (endedSpan === span) { - logger.debug(`Removing AppState listener for ${spanToJSON(span).op} transaction.`); + debug.log(`Removing AppState listener for ${spanToJSON(span).op} transaction.`); subscription?.remove?.(); } }); diff --git a/packages/core/src/js/tracing/reactnativeprofiler.tsx b/packages/core/src/js/tracing/reactnativeprofiler.tsx index 0798c92c94..6a32b9971c 100644 --- a/packages/core/src/js/tracing/reactnativeprofiler.tsx +++ b/packages/core/src/js/tracing/reactnativeprofiler.tsx @@ -1,4 +1,4 @@ -import { logger, timestampInSeconds } from '@sentry/core'; +import { debug, timestampInSeconds } from '@sentry/core'; import { getClient, Profiler } from '@sentry/react'; import { getAppRegistryIntegration } from '../integrations/appRegistry'; import { createIntegration } from '../integrations/factory'; @@ -54,7 +54,7 @@ export class ReactNativeProfiler extends Profiler { if (appRegistryIntegration && typeof appRegistryIntegration.onRunApplication === 'function') { appRegistryIntegration.onRunApplication(ReactNativeProfilerGlobalState.onRunApplicationHook); } else { - logger.warn('AppRegistryIntegration.onRunApplication not found or invalid.'); + debug.warn('AppRegistryIntegration.onRunApplication not found or invalid.'); } // eslint-disable-next-line @typescript-eslint/no-floating-promises diff --git a/packages/core/src/js/tracing/reactnavigation.ts b/packages/core/src/js/tracing/reactnavigation.ts index 360a5ae807..28666b0f89 100644 --- a/packages/core/src/js/tracing/reactnavigation.ts +++ b/packages/core/src/js/tracing/reactnavigation.ts @@ -2,9 +2,9 @@ import type { Client, Integration, Span } from '@sentry/core'; import { addBreadcrumb, + debug, getClient, isPlainObject, - logger, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_OK, @@ -112,7 +112,7 @@ export const reactNavigationIntegration = ({ if (enableTimeToInitialDisplay) { NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => { - logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`); + debug.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`); }); } @@ -140,7 +140,7 @@ export const reactNavigationIntegration = ({ // To avoid conflict with the initial transaction we check if it was already handled. // This ensures runApplication calls after the initial start are correctly traced. // This is used for example when Activity is (re)started on Android. - logger.log('[ReactNavigationIntegration] Starting new idle navigation span based on runApplication call.'); + debug.log('[ReactNavigationIntegration] Starting new idle navigation span based on runApplication call.'); startIdleNavigationSpan(); } }); @@ -159,7 +159,7 @@ export const reactNavigationIntegration = ({ const registerNavigationContainer = (maybeNewNavigationContainer: unknown): void => { if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) { - logger.debug(`${INTEGRATION_NAME} Instrumentation already exists, but registering again...`); + debug.log(`${INTEGRATION_NAME} Instrumentation already exists, but registering again...`); // In the past we have not allowed re-registering the navigation container to avoid unexpected behavior. // But this doesn't work for Android and re-recreating application main activity. // Where new navigation container is created and the old one is discarded. We need to re-register to @@ -174,13 +174,13 @@ export const reactNavigationIntegration = ({ } if (navigationContainer === newNavigationContainer) { - logger.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`); + debug.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`); return; } navigationContainer = newNavigationContainer as NavigationContainer; if (!navigationContainer) { - logger.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`); + debug.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`); return undefined; } @@ -194,7 +194,7 @@ export const reactNavigationIntegration = ({ } if (!latestNavigationSpan) { - logger.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`); + debug.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`); return undefined; } @@ -213,7 +213,7 @@ export const reactNavigationIntegration = ({ const startIdleNavigationSpan = (unknownEvent?: unknown): void => { const event = unknownEvent as UnsafeAction | undefined; if (useDispatchedActionData && event?.data.noop) { - logger.debug(`${INTEGRATION_NAME} Navigation action is a noop, not starting navigation span.`); + debug.log(`${INTEGRATION_NAME} Navigation action is a noop, not starting navigation span.`); return; } @@ -231,12 +231,12 @@ export const reactNavigationIntegration = ({ 'TOGGLE_DRAWER', ].includes(navigationActionType) ) { - logger.debug(`${INTEGRATION_NAME} Navigation action is ${navigationActionType}, not starting navigation span.`); + debug.log(`${INTEGRATION_NAME} Navigation action is ${navigationActionType}, not starting navigation span.`); return; } if (latestNavigationSpan) { - logger.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`); + debug.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`); _discardLatestTransaction(); clearStateChangeTimeout(); } @@ -277,18 +277,18 @@ export const reactNavigationIntegration = ({ const previousRoute = latestRoute; if (!navigationContainer) { - logger.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`); + debug.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`); return undefined; } const route = navigationContainer.getCurrentRoute(); if (!route) { - logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`); + debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`); return undefined; } if (!latestNavigationSpan) { - logger.debug( + debug.log( `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`, ); return undefined; @@ -297,7 +297,7 @@ export const reactNavigationIntegration = ({ addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay()); if (previousRoute && previousRoute.key === route.key) { - logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`); + debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`); pushRecentRouteKey(route.key); latestRoute = route; diff --git a/packages/core/src/js/tracing/span.ts b/packages/core/src/js/tracing/span.ts index 7db6fb2496..88b54c3070 100644 --- a/packages/core/src/js/tracing/span.ts +++ b/packages/core/src/js/tracing/span.ts @@ -1,10 +1,10 @@ import type { Client, Scope, Span, SpanJSON, StartSpanOptions } from '@sentry/core'; import { + debug, generateTraceId, getActiveSpan, getClient, getCurrentScope, - logger, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, @@ -53,14 +53,14 @@ export const startIdleNavigationSpan = ( ): Span | undefined => { const client = getClient(); if (!client) { - logger.warn("[startIdleNavigationSpan] Can't create route change span, missing client."); + debug.warn("[startIdleNavigationSpan] Can't create route change span, missing client."); return undefined; } const activeSpan = getActiveSpan(); clearActiveSpanFromScope(getCurrentScope()); if (activeSpan && isRootSpan(activeSpan) && isSentryInteractionSpan(activeSpan)) { - logger.log( + debug.log( `[startIdleNavigationSpan] Canceling ${ spanToJSON(activeSpan).op } transaction because of a new navigation root span.`, @@ -75,7 +75,7 @@ export const startIdleNavigationSpan = ( }; const idleSpan = startIdleSpan(finalStartSpanOptions, { finalTimeout, idleTimeout }); - logger.log( + debug.log( `[startIdleNavigationSpan] Starting ${finalStartSpanOptions.op || 'unknown op'} transaction "${ finalStartSpanOptions.name }" on scope`, @@ -100,13 +100,13 @@ export const startIdleSpan = ( ): Span => { const client = getClient(); if (!client) { - logger.warn("[startIdleSpan] Can't create idle span, missing client."); + debug.warn("[startIdleSpan] Can't create idle span, missing client."); return new SentryNonRecordingSpan(); } const currentAppState = AppState.currentState; if (currentAppState === 'background') { - logger.debug(`[startIdleSpan] App is already in background, not starting span for ${startSpanOption.name}`); + debug.log(`[startIdleSpan] App is already in background, not starting span for ${startSpanOption.name}`); return new SentryNonRecordingSpan(); } diff --git a/packages/core/src/js/tracing/timetodisplay.tsx b/packages/core/src/js/tracing/timetodisplay.tsx index 3ffa223c46..8dee22ff40 100644 --- a/packages/core/src/js/tracing/timetodisplay.tsx +++ b/packages/core/src/js/tracing/timetodisplay.tsx @@ -1,5 +1,5 @@ import type { Span,StartSpanOptions } from '@sentry/core'; -import { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core'; +import { debug, fill, getActiveSpan, getSpanDescendants, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core'; import * as React from 'react'; import { useState } from 'react'; import { isTurboModuleEnabled } from '../utils/environment'; @@ -67,7 +67,7 @@ function TimeToDisplay(props: { nativeComponentMissingLogged = true; // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace. setTimeout(() => { - logger.warn( + debug.warn( 'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native'); }, 0); } @@ -98,13 +98,13 @@ export function startTimeToInitialDisplaySpan( ): Span | undefined { const activeSpan = getActiveSpan(); if (!activeSpan) { - logger.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.'); + debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.'); return undefined; } const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display'); if (existingSpan) { - logger.debug('[TimeToDisplay] Found existing ui.load.initial_display span.'); + debug.log('[TimeToDisplay] Found existing ui.load.initial_display span.'); return existingSpan } @@ -147,7 +147,7 @@ export function startTimeToFullDisplaySpan( ): Span | undefined { const activeSpan = getActiveSpan(); if (!activeSpan) { - logger.warn('[TimeToDisplay] No active span found to attach ui.load.full_display to.'); + debug.warn('[TimeToDisplay] No active span found to attach ui.load.full_display to.'); return undefined; } @@ -155,13 +155,13 @@ export function startTimeToFullDisplaySpan( const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display'); if (!initialDisplaySpan) { - logger.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.'); + debug.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.'); return undefined; } const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display'); if (existingSpan) { - logger.debug('[TimeToDisplay] Found existing ui.load.full_display span.'); + debug.log('[TimeToDisplay] Found existing ui.load.full_display span.'); return existingSpan; } @@ -182,7 +182,7 @@ export function startTimeToFullDisplaySpan( fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' }); fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp); setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan); - logger.warn('[TimeToDisplay] Full display span deadline_exceeded.'); + debug.warn('[TimeToDisplay] Full display span deadline_exceeded.'); }, options.timeoutMs); fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters[0]) => { @@ -215,32 +215,32 @@ export function updateInitialDisplaySpan( span?: Span; } = {}): void { if (!span) { - logger.warn('[TimeToDisplay] No span found or created, possibly performance is disabled.'); + debug.warn('[TimeToDisplay] No span found or created, possibly performance is disabled.'); return; } if (!activeSpan) { - logger.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.'); + debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.'); return; } if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) { - logger.warn('[TimeToDisplay] Initial display span is not a child of current active span.'); + debug.warn('[TimeToDisplay] Initial display span is not a child of current active span.'); return; } if (spanToJSON(span).timestamp) { - logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`); + debug.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`); return; } span.end(frameTimestampSeconds); span.setStatus({ code: SPAN_STATUS_OK }); - logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`); + debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`); if (fullDisplayBeforeInitialDisplay.has(activeSpan)) { fullDisplayBeforeInitialDisplay.delete(activeSpan); - logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); + debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); updateFullDisplaySpan(frameTimestampSeconds, span); } @@ -250,7 +250,7 @@ export function updateInitialDisplaySpan( function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void { const activeSpan = getActiveSpan(); if (!activeSpan) { - logger.warn('[TimeToDisplay] No active span found to update ui.load.full_display in.'); + debug.warn('[TimeToDisplay] No active span found to update ui.load.full_display in.'); return; } @@ -259,7 +259,7 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp; if (!initialDisplayEndTimestamp) { fullDisplayBeforeInitialDisplay.set(activeSpan, true); - logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`); + debug.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`); return; } @@ -267,25 +267,25 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl isAutoInstrumented: true, }); if (!span) { - logger.warn('[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.'); + debug.warn('[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.'); return; } const spanJSON = spanToJSON(span); if (spanJSON.timestamp) { - logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`); + debug.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`); return; } if (initialDisplayEndTimestamp > frameTimestampSeconds) { - logger.warn('[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.'); + debug.warn('[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.'); span.end(initialDisplayEndTimestamp); } else { span.end(frameTimestampSeconds); } span.setStatus({ code: SPAN_STATUS_OK }); - logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`); + debug.log(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`); setSpanDurationAsMeasurement('time_to_full_display', span); } diff --git a/packages/core/src/js/tracing/utils.ts b/packages/core/src/js/tracing/utils.ts index 18dc9d37f4..ecd3e14128 100644 --- a/packages/core/src/js/tracing/utils.ts +++ b/packages/core/src/js/tracing/utils.ts @@ -1,8 +1,8 @@ import type { MeasurementUnit, Span, SpanJSON, TransactionSource } from '@sentry/core'; import { + debug, dropUndefinedKeys, getSpanDescendants, - logger, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, @@ -97,7 +97,7 @@ export function getLatestChildSpanEndTimestamp(span: Span): number | undefined { export function getBundleStartTimestampMs(): number | undefined { const bundleStartTime = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__; if (!bundleStartTime) { - logger.warn('Missing the bundle start time on the global object.'); + debug.warn('Missing the bundle start time on the global object.'); return undefined; } diff --git a/packages/core/src/js/utils/safe.ts b/packages/core/src/js/utils/safe.ts index 3508e31ebb..7deb1d8d4c 100644 --- a/packages/core/src/js/utils/safe.ts +++ b/packages/core/src/js/utils/safe.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import type { ReactNativeOptions } from '../options'; type DangerTypesWithoutCallSignature = @@ -23,7 +23,7 @@ export function safeFactory void): void { const map = listenersMap.get(eventType); if (!map) { - logger.warn(`EventEmitter was not initialized for event type: ${eventType}`); + debug.warn(`EventEmitter was not initialized for event type: ${eventType}`); return; } listenersMap.get(eventType)?.set(listener, true); @@ -92,19 +92,19 @@ export function createSentryEventEmitter( function createNoopSentryEventEmitter(): SentryEventEmitter { return { initAsync: () => { - logger.warn('Noop SentryEventEmitter: initAsync'); + debug.warn('Noop SentryEventEmitter: initAsync'); }, closeAllAsync: () => { - logger.warn('Noop SentryEventEmitter: closeAllAsync'); + debug.warn('Noop SentryEventEmitter: closeAllAsync'); }, addListener: () => { - logger.warn('Noop SentryEventEmitter: addListener'); + debug.warn('Noop SentryEventEmitter: addListener'); }, removeListener: () => { - logger.warn('Noop SentryEventEmitter: removeListener'); + debug.warn('Noop SentryEventEmitter: removeListener'); }, once: () => { - logger.warn('Noop SentryEventEmitter: once'); + debug.warn('Noop SentryEventEmitter: once'); }, }; } diff --git a/packages/core/src/js/utils/sentryeventemitterfallback.ts b/packages/core/src/js/utils/sentryeventemitterfallback.ts index a10b62117b..5cb413d770 100644 --- a/packages/core/src/js/utils/sentryeventemitterfallback.ts +++ b/packages/core/src/js/utils/sentryeventemitterfallback.ts @@ -1,4 +1,4 @@ -import { logger, timestampInSeconds } from '@sentry/core'; +import { debug, timestampInSeconds } from '@sentry/core'; import { NATIVE } from '../wrapper'; import type { NewFrameEvent, SentryEventEmitter } from './sentryeventemitter'; import { createSentryEventEmitter, NewFrameEventName } from './sentryeventemitter'; @@ -48,7 +48,7 @@ export function createSentryFallbackEventEmitter( nativeNewFrameTimestampSeconds = resolve ?? undefined; }) .catch(reason => { - logger.error('Failed to receive Native fallback timestamp.', reason); + debug.error('Failed to receive Native fallback timestamp.', reason); }); } @@ -72,20 +72,20 @@ export function createSentryFallbackEventEmitter( }; fallbackTimeout = setTimeout(() => { if (nativeNewFrameTimestampSeconds) { - logger.log('Native event emitter did not reply in time'); + debug.log('Native event emitter did not reply in time'); return listener({ newFrameTimestampInSeconds: nativeNewFrameTimestampSeconds, isFallback: true, }); } else if (animationFrameTimestampSeconds) { - logger.log('[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.'); + debug.log('[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.'); return listener({ newFrameTimestampInSeconds: animationFrameTimestampSeconds, isFallback: true, }); } else { emitter.removeListener(NewFrameEventName, internalListener); - logger.error('Failed to receive any fallback timestamp.'); + debug.error('Failed to receive any fallback timestamp.'); } }, fallbackTimeoutMs); diff --git a/packages/core/src/js/wrapper.ts b/packages/core/src/js/wrapper.ts index 955c5245d7..6829182298 100644 --- a/packages/core/src/js/wrapper.ts +++ b/packages/core/src/js/wrapper.ts @@ -10,7 +10,7 @@ import type { SeverityLevel, User, } from '@sentry/core'; -import { logger, normalize, SentryError } from '@sentry/core'; +import { debug, normalize, SentryError } from '@sentry/core'; import { NativeModules, Platform } from 'react-native'; import { isHardCrash } from './misc'; import type { @@ -162,7 +162,7 @@ export const NATIVE: SentryNativeWrapper = { */ async sendEnvelope(envelope: Envelope): Promise { if (!this.enableNative) { - logger.warn('Event was skipped as native SDK is not enabled.'); + debug.warn('Event was skipped as native SDK is not enabled.'); return; } @@ -232,14 +232,14 @@ export const NATIVE: SentryNativeWrapper = { if (!options.enableNative) { if (options.enableNativeNagger) { - logger.warn('Note: Native Sentry SDK is disabled.'); + debug.warn('Note: Native Sentry SDK is disabled.'); } this.enableNative = false; return false; } if (!options.autoInitializeNativeSdk) { if (options.enableNativeNagger) { - logger.warn( + debug.warn( 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false', ); } @@ -248,7 +248,7 @@ export const NATIVE: SentryNativeWrapper = { } if (!options.dsn) { - logger.warn( + debug.warn( 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.', ); this.enableNative = false; @@ -340,11 +340,11 @@ export const NATIVE: SentryNativeWrapper = { async fetchNativeAppStart(): Promise { if (!this.enableNative) { - logger.warn(this._DisabledNativeError); + debug.warn(this._DisabledNativeError); return null; } if (!this._isModuleLoaded(RNSentry)) { - logger.error(this._NativeClientError); + debug.error(this._NativeClientError); return null; } @@ -453,7 +453,7 @@ export const NATIVE: SentryNativeWrapper = { const normalizedExtra = normalize(extra); stringifiedExtra = JSON.stringify(normalizedExtra); } catch (e) { - logger.error('Extra for key ${key} not passed to native SDK, because it contains non-stringifiable values', e); + debug.error('Extra for key ${key} not passed to native SDK, because it contains non-stringifiable values', e); } if (typeof stringifiedExtra === 'string') { @@ -517,7 +517,7 @@ export const NATIVE: SentryNativeWrapper = { try { normalizedContext = convertToNormalizedObject(context); } catch (e) { - logger.error('Context for key ${key} not passed to native SDK, because it contains non-serializable values', e); + debug.error('Context for key ${key} not passed to native SDK, because it contains non-serializable values', e); } if (normalizedContext) { @@ -571,11 +571,11 @@ export const NATIVE: SentryNativeWrapper = { async captureScreenshot(): Promise { if (!this.enableNative) { - logger.warn(this._DisabledNativeError); + debug.warn(this._DisabledNativeError); return null; } if (!this._isModuleLoaded(RNSentry)) { - logger.error(this._NativeClientError); + debug.error(this._NativeClientError); return null; } @@ -583,7 +583,7 @@ export const NATIVE: SentryNativeWrapper = { try { raw = await RNSentry.captureScreenshot(); } catch (e) { - logger.warn('Failed to capture screenshot', e); + debug.warn('Failed to capture screenshot', e); } if (raw) { @@ -618,9 +618,9 @@ export const NATIVE: SentryNativeWrapper = { const { started, error } = RNSentry.startProfiling(platformProfilers); if (started) { - logger.log('[NATIVE] Start Profiling'); + debug.log('[NATIVE] Start Profiling'); } else { - logger.error('[NATIVE] Start Profiling Failed', error); + debug.error('[NATIVE] Start Profiling Failed', error); } return !!started; @@ -640,14 +640,14 @@ export const NATIVE: SentryNativeWrapper = { const { profile, nativeProfile, androidProfile, error } = RNSentry.stopProfiling(); if (!profile || error) { - logger.error('[NATIVE] Stop Profiling Failed', error); + debug.error('[NATIVE] Stop Profiling Failed', error); return null; } if (Platform.OS === 'ios' && !nativeProfile) { - logger.warn('[NATIVE] Stop Profiling Failed: No Native Profile'); + debug.warn('[NATIVE] Stop Profiling Failed: No Native Profile'); } if (Platform.OS === 'android' && !androidProfile) { - logger.warn('[NATIVE] Stop Profiling Failed: No Android Profile'); + debug.warn('[NATIVE] Stop Profiling Failed: No Android Profile'); } try { @@ -657,7 +657,7 @@ export const NATIVE: SentryNativeWrapper = { androidProfile: androidProfile as NativeAndroidProfileEvent | undefined, }; } catch (e) { - logger.error('[NATIVE] Failed to parse Hermes Profile JSON', e); + debug.error('[NATIVE] Failed to parse Hermes Profile JSON', e); return null; } }, @@ -697,11 +697,11 @@ export const NATIVE: SentryNativeWrapper = { async captureReplay(isHardCrash: boolean): Promise { if (!this.enableNative) { - logger.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is disabled.`); + debug.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is disabled.`); return Promise.resolve(null); } if (!this._isModuleLoaded(RNSentry)) { - logger.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is not available.`); + debug.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is not available.`); return Promise.resolve(null); } @@ -710,11 +710,11 @@ export const NATIVE: SentryNativeWrapper = { getCurrentReplayId(): string | null { if (!this.enableNative) { - logger.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is disabled.`); + debug.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is disabled.`); return null; } if (!this._isModuleLoaded(RNSentry)) { - logger.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is not available.`); + debug.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is not available.`); return null; } @@ -749,7 +749,7 @@ export const NATIVE: SentryNativeWrapper = { const data: number[] = await RNSentry.getDataFromUri(uri); return new Uint8Array(data); } catch (error) { - logger.error('Error:', error); + debug.error('Error:', error); return null; } }, @@ -762,7 +762,7 @@ export const NATIVE: SentryNativeWrapper = { try { return RNSentry.popTimeToDisplayFor(key); } catch (error) { - logger.error('Error:', error); + debug.error('Error:', error); return Promise.resolve(null); } }, @@ -775,7 +775,7 @@ export const NATIVE: SentryNativeWrapper = { try { RNSentry.setActiveSpanId(spanId); } catch (error) { - logger.error('Error:', error); + debug.error('Error:', error); return undefined; } }, @@ -790,7 +790,7 @@ export const NATIVE: SentryNativeWrapper = { const base64 = await RNSentry.encodeToBase64(byteArray); return base64 || null; } catch (error) { - logger.error('Error:', error); + debug.error('Error:', error); return Promise.resolve(null); } }, diff --git a/packages/core/test/feedback/FeedbackWidgetManager.test.tsx b/packages/core/test/feedback/FeedbackWidgetManager.test.tsx index bfb67c91d1..0f2703e54c 100644 --- a/packages/core/test/feedback/FeedbackWidgetManager.test.tsx +++ b/packages/core/test/feedback/FeedbackWidgetManager.test.tsx @@ -1,4 +1,4 @@ -import { getClient, logger, setCurrentClient } from '@sentry/core'; +import { debug, getClient, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react-native'; import * as React from 'react'; import { Appearance, Text } from 'react-native'; @@ -20,7 +20,7 @@ const consoleWarnSpy = jest.spyOn(console, 'warn'); const mockedIsModalSupported = isModalSupported as jest.MockedFunction; beforeEach(() => { - logger.error = jest.fn(); + debug.error = jest.fn(); }); describe('FeedbackWidgetManager', () => { @@ -59,7 +59,7 @@ describe('FeedbackWidgetManager', () => { expect(queryByTestId('feedback-form-modal')).toBeNull(); expect(getByText('App Components')).toBeTruthy(); - expect(logger.error).toHaveBeenLastCalledWith( + expect(debug.error).toHaveBeenLastCalledWith( 'FeedbackWidget Modal is not supported in React Native < 0.71 with Fabric renderer.', ); }); diff --git a/packages/core/test/integrations/logEnricherIntegration.test.ts b/packages/core/test/integrations/logEnricherIntegration.test.ts index fc75ecaa3b..c15e39c2ab 100644 --- a/packages/core/test/integrations/logEnricherIntegration.test.ts +++ b/packages/core/test/integrations/logEnricherIntegration.test.ts @@ -1,5 +1,5 @@ import type { Client, Log } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { logEnricherIntegration } from '../../src/js/integrations/logEnricherIntegration'; import type { NativeDeviceContextsResponse } from '../../src/js/NativeRNSentry'; import { NATIVE } from '../../src/js/wrapper'; @@ -8,12 +8,12 @@ import { NATIVE } from '../../src/js/wrapper'; jest.mock('../../src/js/wrapper'); jest.mock('@sentry/core', () => ({ ...jest.requireActual('@sentry/core'), - logger: { + debug: { log: jest.fn(), }, })); -const mockLogger = logger as jest.Mocked; +const mockLogger = debug as jest.Mocked; function on_beforeCaptureLogCount(client: jest.Mocked) { const beforeCaptureLogCalls = client.on.mock.calls.filter( diff --git a/packages/core/test/mocks/client.ts b/packages/core/test/mocks/client.ts index c2aa9c397e..5dd3c56b25 100644 --- a/packages/core/test/mocks/client.ts +++ b/packages/core/test/mocks/client.ts @@ -1,6 +1,6 @@ import type { Event, EventHint, Integration, Outcome, ParameterizedString, Session, SeverityLevel } from '@sentry/core'; import { - BaseClient, + Client, createTransport, getCurrentScope, getGlobalScope, @@ -36,7 +36,7 @@ export interface TestClientOptions extends ReactNativeClientOptions { defaultIntegrations?: Integration[] | false; } -export class TestClient extends BaseClient { +export class TestClient extends Client { public static instance?: TestClient; public static sendEventCalled?: (event: Event) => void; diff --git a/packages/core/test/profiling/integration.test.ts b/packages/core/test/profiling/integration.test.ts index 9fb4e425cc..bd904136fb 100644 --- a/packages/core/test/profiling/integration.test.ts +++ b/packages/core/test/profiling/integration.test.ts @@ -42,7 +42,10 @@ describe('profiling integration', () => { type: 'sourcemap', }, ]); - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); }); afterEach(async () => { diff --git a/packages/core/test/sdk.test.ts b/packages/core/test/sdk.test.ts index 6380216228..0c48cad447 100644 --- a/packages/core/test/sdk.test.ts +++ b/packages/core/test/sdk.test.ts @@ -1,5 +1,5 @@ import type { BaseTransportOptions, Breadcrumb, BreadcrumbHint, ClientOptions, Integration, Scope } from '@sentry/core'; -import { initAndBind, logger } from '@sentry/core'; +import { debug, initAndBind } from '@sentry/core'; import { makeFetchTransport } from '@sentry/react'; import { getDevServer } from '../src/js/integrations/debugsymbolicatorutils'; import { init, withScope } from '../src/js/sdk'; @@ -11,7 +11,7 @@ import { RN_GLOBAL_OBJ } from '../src/js/utils/worldwide'; import { NATIVE } from './mockWrapper'; import { firstArg, secondArg } from './testutils'; -jest.spyOn(logger, 'error'); +jest.spyOn(debug, 'error'); jest.mock('../src/js/wrapper', () => jest.requireActual('./mockWrapper')); jest.mock('../src/js/utils/environment'); jest.mock('@sentry/core', () => ({ diff --git a/packages/core/test/sdk.withclient.test.ts b/packages/core/test/sdk.withclient.test.ts index c6aeedd81a..0d7258ef63 100644 --- a/packages/core/test/sdk.withclient.test.ts +++ b/packages/core/test/sdk.withclient.test.ts @@ -1,10 +1,10 @@ -import { logger, setCurrentClient } from '@sentry/core'; +import { debug, setCurrentClient } from '@sentry/core'; import { crashedLastRun, flush } from '../src/js/sdk'; import { getDefaultTestClientOptions, TestClient } from './mocks/client'; import { NATIVE } from './mockWrapper'; jest.mock('../src/js/wrapper.ts', () => jest.requireActual('./mockWrapper')); -jest.spyOn(logger, 'error'); +jest.spyOn(debug, 'error'); describe('Tests the SDK functionality', () => { let client: TestClient; @@ -32,7 +32,7 @@ describe('Tests the SDK functionality', () => { expect(client.flush).toBeCalled(); expect(flushResult).toBe(false); - expect(logger.error).toBeCalledWith('Failed to flush the event queue.'); + expect(debug.error).toBeCalledWith('Failed to flush the event queue.'); }); }); diff --git a/packages/core/test/tools/collectModules.test.ts b/packages/core/test/tools/collectModules.test.ts index 3b65e3aa7a..16e779cde8 100644 --- a/packages/core/test/tools/collectModules.test.ts +++ b/packages/core/test/tools/collectModules.test.ts @@ -1,9 +1,9 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { existsSync, readFileSync, rmdirSync, unlinkSync } from 'fs'; import { dirname } from 'path'; jest.mock('@sentry/core'); -(logger.enable as jest.Mock).mockImplementation(() => {}); +(debug.enable as jest.Mock).mockImplementation(() => {}); import ModulesCollector from '../../src/js/tools/ModulesCollector'; diff --git a/packages/core/test/tracing/gesturetracing.test.ts b/packages/core/test/tracing/gesturetracing.test.ts index aa57bc199a..d0023bc1cc 100644 --- a/packages/core/test/tracing/gesturetracing.test.ts +++ b/packages/core/test/tracing/gesturetracing.test.ts @@ -54,7 +54,10 @@ describe('GestureTracing', () => { beforeEach(() => { jest.clearAllMocks(); - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); client = setupTestClient({ enableUserInteractionTracing: true, }); diff --git a/packages/core/test/tracing/integrations/nativeframes.test.ts b/packages/core/test/tracing/integrations/nativeframes.test.ts index 0b426f945d..143ef6c787 100644 --- a/packages/core/test/tracing/integrations/nativeframes.test.ts +++ b/packages/core/test/tracing/integrations/nativeframes.test.ts @@ -16,7 +16,10 @@ jest.mock('../../../src/js/wrapper', () => { }; }); -jest.useFakeTimers({ advanceTimers: true }); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API +}); const mockDate = new Date(2024, 7, 14); // Set your desired mock date here const originalDateNow = Date.now; // Store the original Date.now function diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts index bf1eb231ee..e83d0d505b 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts @@ -20,7 +20,10 @@ describe('BackgroundEventListener', () => { stallTracking['_internalState']['lastIntervalMs'] = currentTime; stallTracking['_internalState']['timeout'] = setTimeout(() => {}, LOOP_TIMEOUT_INTERVAL_MS); // Create a fake timeout to simulate a running interval stallTracking['_internalState']['isBackground'] = true; - jest.useFakeTimers(); // Enable fake timers to control timeouts + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); stallTracking['_internalState']['backgroundEventListener']('active' as AppStateStatus); // Check if _isBackground is set to false and _lastIntervalMs is updated correctly expect(stallTracking['_internalState']['isBackground']).toBe(false); @@ -39,7 +42,10 @@ describe('BackgroundEventListener', () => { stallTracking['_internalState']['timeout'] = null; // Mock _iteration stallTracking['_internalState']['iteration'] = jest.fn(); - jest.useFakeTimers(); // Enable fake timers to control timeouts + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); stallTracking['_internalState']['backgroundEventListener']('active' as AppStateStatus); expect(stallTracking['_internalState']['iteration']).not.toBeCalled(); @@ -49,7 +55,10 @@ describe('BackgroundEventListener', () => { stallTracking['_internalState']['timeout'] = setTimeout(() => {}, 500); // Mock _iteration stallTracking['_internalState']['iteration'] = jest.fn(); // Create a fake timeout to simulate a running interval - jest.useFakeTimers(); // Enable fake timers to control timeouts + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); stallTracking['_internalState']['backgroundEventListener']('active' as AppStateStatus); expect(stallTracking['_internalState']['iteration']).toBeCalled(); }); diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.iteration.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.iteration.test.ts index 53c6c84439..eb6efec02a 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.iteration.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.iteration.test.ts @@ -19,7 +19,10 @@ describe('Iteration', () => { stallTracking['isTracking'] = false; stallTracking['_internalState']['isBackground'] = false; stallTracking['_internalState']['lastIntervalMs'] = Date.now() - 1000; // Force a timeout - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); // Invokes the private _interaction function. stallTracking['_internalState']['iteration'](); expect(stallTracking['_internalState']['timeout']).toBeNull(); @@ -29,7 +32,10 @@ describe('Iteration', () => { stallTracking['isTracking'] = true; stallTracking['_internalState']['isBackground'] = true; stallTracking['_internalState']['lastIntervalMs'] = Date.now() - 1000; // Force a timeout - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); // Invokes the private _interaction function. stallTracking['_internalState']['iteration'](); expect(stallTracking['_internalState']['timeout']).toBeNull(); @@ -38,7 +44,10 @@ describe('Iteration', () => { const stallTracking = stallTrackingIntegration() as StallTrackingWithTestProperties; stallTracking['isTracking'] = true; stallTracking['_internalState']['isBackground'] = false; - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); stallTracking['_internalState']['lastIntervalMs'] = Date.now(); // Force a timeout // Invokes the private _interaction function. stallTracking['_internalState']['iteration'](); @@ -50,7 +59,10 @@ describe('Iteration', () => { const _minimumStallThreshold = 100; // Call _iteration with totalTimeTaken >= LOOP_TIMEOUT_INTERVAL_MS + _minimumStallThreshold const totalTimeTaken = LOOP_TIMEOUT_INTERVAL_MS + _minimumStallThreshold; - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); stallTracking['_internalState']['lastIntervalMs'] = Date.now() - totalTimeTaken; stallTracking['_internalState']['statsByTransaction'] = new Map(); stallTracking['_internalState']['iteration'](); diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts index 1cadf3f7d5..e357984fe7 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts @@ -13,7 +13,10 @@ import { stallTrackingIntegration } from '../../../../src/js/tracing/integration import { getDefaultTestClientOptions, TestClient } from '../../../mocks/client'; import { expectNonZeroStallMeasurements, expectStallMeasurements } from './stalltrackingutils'; -jest.useFakeTimers({ advanceTimers: true }); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['Date', 'performance'], // Keep real Date/performance APIs +}); const expensiveOperation = () => { const expensiveObject: { value: string[] } = { diff --git a/packages/core/test/tracing/integrations/userInteraction.test.ts b/packages/core/test/tracing/integrations/userInteraction.test.ts index 25f2053cb0..19a65c4071 100644 --- a/packages/core/test/tracing/integrations/userInteraction.test.ts +++ b/packages/core/test/tracing/integrations/userInteraction.test.ts @@ -62,7 +62,10 @@ describe('User Interaction Tracing', () => { let mockedUserInteractionId: { elementId: string | undefined; op: string }; beforeEach(() => { - jest.useFakeTimers(); + jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API + }); NATIVE.enableNative = true; mockedAppState.isAvailable = true; mockedAppState.currentState = 'active'; diff --git a/packages/core/test/tracing/reactnativenavigation.test.ts b/packages/core/test/tracing/reactnativenavigation.test.ts index 77d02db915..5ecb73b416 100644 --- a/packages/core/test/tracing/reactnativenavigation.test.ts +++ b/packages/core/test/tracing/reactnativenavigation.test.ts @@ -43,7 +43,10 @@ interface MockEventsRegistry extends EventsRegistry { onBottomTabPressed(event: BottomTabPressedEvent): void; } -jest.useFakeTimers({ advanceTimers: true }); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API +}); describe('React Native Navigation Instrumentation', () => { let mockEventsRegistry: MockEventsRegistry; diff --git a/packages/core/test/tracing/reactnavigation.stalltracking.test.ts b/packages/core/test/tracing/reactnavigation.stalltracking.test.ts index 7f4f4ade6e..0d6e5fda9a 100644 --- a/packages/core/test/tracing/reactnavigation.stalltracking.test.ts +++ b/packages/core/test/tracing/reactnavigation.stalltracking.test.ts @@ -12,7 +12,10 @@ import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; import { expectStallMeasurements } from './integrations/stallTracking/stalltrackingutils'; import { createMockNavigationAndAttachTo } from './reactnavigationutils'; -jest.useFakeTimers({ advanceTimers: 1 }); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API +}); describe('StallTracking with ReactNavigation', () => { let client: TestClient; diff --git a/packages/core/test/tracing/reactnavigation.test.ts b/packages/core/test/tracing/reactnavigation.test.ts index db55874a91..0b7ce0a1aa 100644 --- a/packages/core/test/tracing/reactnavigation.test.ts +++ b/packages/core/test/tracing/reactnavigation.test.ts @@ -43,7 +43,10 @@ jest.mock('../../src/js/wrapper.ts', () => jest.requireActual('../mockWrapper.ts jest.mock('./../../src/js/integrations/debugsymbolicatorutils', () => ({ getDevServer: jest.fn(), })); -jest.useFakeTimers({ advanceTimers: true }); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'], // Keep real performance API +}); class MockNavigationContainer { currentRoute: NavigationRoute | undefined = dummyRoute; diff --git a/packages/core/test/tracing/timetodisplay.test.tsx b/packages/core/test/tracing/timetodisplay.test.tsx index ab2b8e1744..8a00c5f7ed 100644 --- a/packages/core/test/tracing/timetodisplay.test.tsx +++ b/packages/core/test/tracing/timetodisplay.test.tsx @@ -1,7 +1,7 @@ import type { Event, Measurements, Span, SpanJSON} from '@sentry/core'; -import { getCurrentScope, getGlobalScope, getIsolationScope, logger , setCurrentClient, spanToJSON, startSpanManual } from '@sentry/core'; +import { debug , getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, spanToJSON, startSpanManual } from '@sentry/core'; -jest.spyOn(logger, 'warn'); +jest.spyOn(debug, 'warn'); import * as mockWrapper from '../mockWrapper'; @@ -29,7 +29,10 @@ jest.mock('../../src/js/utils/environment', () => ({ const { mockRecordedTimeToDisplay, getMockedOnDrawReportedProps, clearMockedOnDrawReportedProps } = mockedtimetodisplaynative; -jest.useFakeTimers({advanceTimers: true}); +jest.useFakeTimers({ + advanceTimers: true, + doNotFake: ['performance'] // Keep real performance API +}); describe('TimeToDisplay', () => { let client: TestClient; @@ -299,7 +302,7 @@ describe('TimeToDisplay', () => { TestRenderer.create(); await jest.runOnlyPendingTimersAsync(); // Flush setTimeout. - expect(logger.warn).not.toHaveBeenCalled(); + expect(debug.warn).not.toHaveBeenCalled(); }); test('should log a warning if in new architecture', async () => { @@ -307,7 +310,7 @@ describe('TimeToDisplay', () => { TestRenderer.create(); await jest.runOnlyPendingTimersAsync(); // Flush setTimeout. - expect(logger.warn).toHaveBeenCalledWith( + expect(debug.warn).toHaveBeenCalledWith( 'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native'); }); }); diff --git a/packages/core/test/utils/sentryeventemitterfallback.test.ts b/packages/core/test/utils/sentryeventemitterfallback.test.ts index f55d57a891..c4e2de2c58 100644 --- a/packages/core/test/utils/sentryeventemitterfallback.test.ts +++ b/packages/core/test/utils/sentryeventemitterfallback.test.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { NewFrameEventName } from '../../src/js/utils/sentryeventemitter'; import { createSentryFallbackEventEmitter } from '../../src/js/utils/sentryeventemitterfallback'; @@ -11,9 +11,9 @@ jest.mock('../../src/js/wrapper', () => jest.requireActual('../mockWrapper')); import { NATIVE } from '../../src/js/wrapper'; -jest.spyOn(logger, 'warn'); -jest.spyOn(logger, 'log'); -jest.spyOn(logger, 'error'); +jest.spyOn(debug, 'warn'); +jest.spyOn(debug, 'log'); +jest.spyOn(debug, 'error'); describe('SentryEventEmitterFallback', () => { let emitter: ReturnType; @@ -47,7 +47,7 @@ describe('SentryEventEmitterFallback', () => { await Promise.resolve(); await expect(NATIVE.getNewScreenTimeToDisplay).toHaveBeenCalled(); - expect(logger.error).not.toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); + expect(debug.error).not.toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); // Simulate retries and timer jest.runAllTimers(); @@ -57,7 +57,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: fallbackTime, isFallback: true, }); - expect(logger.log).toHaveBeenCalledWith( + expect(debug.log).toHaveBeenCalledWith( expect.stringContaining( '[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.', ), @@ -80,7 +80,7 @@ describe('SentryEventEmitterFallback', () => { await Promise.resolve(); await expect(NATIVE.getNewScreenTimeToDisplay).toHaveBeenCalled(); - expect(logger.error).toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); + expect(debug.error).toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); // Simulate retries and timer jest.runAllTimers(); @@ -90,7 +90,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: fallbackTime, isFallback: true, }); - expect(logger.log).toHaveBeenCalledWith( + expect(debug.log).toHaveBeenCalledWith( expect.stringContaining( '[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.', ), @@ -112,7 +112,7 @@ describe('SentryEventEmitterFallback', () => { await Promise.resolve(); await expect(NATIVE.getNewScreenTimeToDisplay).toHaveBeenCalled(); - expect(logger.error).toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); + expect(debug.error).toHaveBeenCalledWith('Failed to receive Native fallback timestamp.', expect.any(Error)); // Simulate retries and timer jest.runAllTimers(); @@ -122,7 +122,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: fallbackTime, isFallback: true, }); - expect(logger.log).toHaveBeenCalledWith( + expect(debug.log).toHaveBeenCalledWith( expect.stringContaining( '[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.', ), @@ -151,7 +151,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: fallbackTime, isFallback: true, }); - expect(logger.log).toHaveBeenCalledWith( + expect(debug.log).toHaveBeenCalledWith( expect.stringContaining( '[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.', ), @@ -210,7 +210,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: 67890, isFallback: undefined, }); - expect(logger.log).not.toBeCalled(); + expect(debug.log).not.toBeCalled(); }); it('should retry up to maxRetries and emit fallback if no response', async () => { @@ -222,13 +222,13 @@ describe('SentryEventEmitterFallback', () => { // Wait for the next event loop to allow startListenerAsync to call NATIVE.getNewScreenTimeToDisplay await Promise.resolve(); - expect(logger.log).not.toHaveBeenCalled(); + expect(debug.log).not.toHaveBeenCalled(); // Simulate retries and timer jest.runAllTimers(); expect(listener).toHaveBeenCalledWith(expect.objectContaining({ isFallback: true })); - expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('Native event emitter did not reply in time')); + expect(debug.log).toHaveBeenCalledWith(expect.stringContaining('Native event emitter did not reply in time')); jest.useRealTimers(); }); diff --git a/packages/core/test/wrap.test.tsx b/packages/core/test/wrap.test.tsx index 8282683772..5d967b7852 100644 --- a/packages/core/test/wrap.test.tsx +++ b/packages/core/test/wrap.test.tsx @@ -1,5 +1,5 @@ // We can't test wrap with mock and non mocked components, otherwise it will break the RN testing library. -import { logger, setCurrentClient } from '@sentry/core'; +import { debug, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react-native'; import * as React from 'react'; import { Text } from 'react-native'; @@ -9,7 +9,7 @@ import { getDefaultTestClientOptions, TestClient } from './mocks/client'; describe('ReactNativeProfiler', () => { it('should wrap the component and init with a warning when getAppRegistryIntegration returns undefined', () => { - logger.warn = jest.fn(); + debug.warn = jest.fn(); const getAppRegistryIntegration = jest.spyOn(AppRegistry, 'getAppRegistryIntegration').mockReturnValueOnce(undefined); const Mock: React.FC = () => Test; const client = new TestClient( @@ -23,7 +23,7 @@ describe('ReactNativeProfiler', () => { const { getByText } = render(); expect(getAppRegistryIntegration).toHaveBeenCalled(); - expect(logger.warn).toHaveBeenCalledWith('AppRegistryIntegration.onRunApplication not found or invalid.'); + expect(debug.warn).toHaveBeenCalledWith('AppRegistryIntegration.onRunApplication not found or invalid.'); expect(getByText('Test')).toBeTruthy(); }); }); diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index c5d071228a..8fc14c89ea 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -1,5 +1,5 @@ import type { Event, EventEnvelope, EventItem, SeverityLevel } from '@sentry/core'; -import { createEnvelope, logger } from '@sentry/core'; +import { createEnvelope, debug } from '@sentry/core'; import * as RN from 'react-native'; import type { Spec } from '../src/js/NativeRNSentry'; import type { ReactNativeOptions } from '../src/js/options'; @@ -108,7 +108,7 @@ describe('Tests Native Wrapper', () => { }); test('warns if there is no dsn', async () => { - logger.warn = jest.fn(); + debug.warn = jest.fn(); await NATIVE.initNativeSdk({ enableNative: true, @@ -118,13 +118,13 @@ describe('Tests Native Wrapper', () => { }); expect(RNSentry.initNativeSdk).not.toBeCalled(); - expect(logger.warn).toHaveBeenLastCalledWith( + expect(debug.warn).toHaveBeenLastCalledWith( 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.', ); }); test('does not call native module with enableNative: false', async () => { - logger.warn = jest.fn(); + debug.warn = jest.fn(); await NATIVE.initNativeSdk({ dsn: 'test', @@ -137,7 +137,7 @@ describe('Tests Native Wrapper', () => { expect(RNSentry.initNativeSdk).not.toBeCalled(); expect(NATIVE.enableNative).toBe(false); - expect(logger.warn).toHaveBeenLastCalledWith('Note: Native Sentry SDK is disabled.'); + expect(debug.warn).toHaveBeenLastCalledWith('Note: Native Sentry SDK is disabled.'); }); test('filter beforeSend when initializing Native SDK', async () => { @@ -214,7 +214,7 @@ describe('Tests Native Wrapper', () => { test('does not initialize with autoInitializeNativeSdk: false', async () => { NATIVE.enableNative = false; - logger.warn = jest.fn(); + debug.warn = jest.fn(); await NATIVE.initNativeSdk({ dsn: 'test', @@ -258,7 +258,7 @@ describe('Tests Native Wrapper', () => { }); test('enableNative: false takes precedence over autoInitializeNativeSdk: false', async () => { - logger.warn = jest.fn(); + debug.warn = jest.fn(); await NATIVE.initNativeSdk({ devServerUrl: undefined, diff --git a/samples/react-native-macos/package.json b/samples/react-native-macos/package.json index ed3e721586..1e556c5e55 100644 --- a/samples/react-native-macos/package.json +++ b/samples/react-native-macos/package.json @@ -16,8 +16,8 @@ "@react-navigation/bottom-tabs": "^6.5.12", "@react-navigation/native": "^6.1.9", "@react-navigation/stack": "^6.3.20", - "@sentry/core": "9.22.0", - "@sentry/react": "9.22.0", + "@sentry/core": "10.7.0", + "@sentry/react": "10.7.0", "@sentry/react-native": "7.0.0-rc.1", "delay": "^6.0.0", "react": "18.2.0", diff --git a/samples/react-native/package.json b/samples/react-native/package.json index 46c5e9d6cd..403b894664 100644 --- a/samples/react-native/package.json +++ b/samples/react-native/package.json @@ -26,7 +26,7 @@ "@react-navigation/native": "7.1.8", "@react-navigation/native-stack": "7.3.12", "@react-navigation/stack": "7.3.1", - "@sentry/core": "9.22.0", + "@sentry/core": "10.7.0", "@sentry/react-native": "7.0.0-rc.1", "@shopify/flash-list": "1.8.0", "delay": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index 04359bffe9..8c49057a9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8914,21 +8914,21 @@ __metadata: languageName: node linkType: hard -"@sentry-internal/browser-utils@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/browser-utils@npm:9.22.0" +"@sentry-internal/browser-utils@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/browser-utils@npm:10.7.0" dependencies: - "@sentry/core": 9.22.0 - checksum: 59f1739c116bf27c2f25d42cc1227a6de6a1c2102412dc93059321003f068e31f9d9a1d9ced3f395a723dc1318a39c979513149c52663457057f2ea18d72bd40 + "@sentry/core": 10.7.0 + checksum: 1f3c17d86ff6caf34acd9e1d824cb2ac0b4cf51dde5f5fc263853454f551f6153e24dbef5ad2ef6128dd869df95a16044901830d3810216dd1fdca96e3048668 languageName: node linkType: hard -"@sentry-internal/eslint-config-sdk@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/eslint-config-sdk@npm:9.22.0" +"@sentry-internal/eslint-config-sdk@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/eslint-config-sdk@npm:10.7.0" dependencies: - "@sentry-internal/eslint-plugin-sdk": 9.22.0 - "@sentry-internal/typescript": 9.22.0 + "@sentry-internal/eslint-plugin-sdk": 10.7.0 + "@sentry-internal/typescript": 10.7.0 "@typescript-eslint/eslint-plugin": ^5.48.0 "@typescript-eslint/parser": ^5.48.0 eslint-config-prettier: ^6.11.0 @@ -8938,43 +8938,43 @@ __metadata: eslint-plugin-simple-import-sort: ^6.0.0 peerDependencies: eslint: ">=5" - checksum: aef911eec68d47f3a640b80d6d21c0ca9e93eae4fe42d2690f3da0af94c6508dd7e96a7e2648548b4e984a032d7844228bc062226e0162467455ad2ea7097a2f + checksum: a78e3c1b09644fb9308e18283e2c50eab251ba71672cf9a8353b93fa64f9743ee11353df1e5c70e48f4bf4604b5477e89e2b397f3b2c5cff4e641593d1b73e72 languageName: node linkType: hard -"@sentry-internal/eslint-plugin-sdk@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/eslint-plugin-sdk@npm:9.22.0" - checksum: 01df33662517e496d41436d688f3a196c494c8fee0d83bac226d16be7086153cc632b4ccfeeb134224af1148a7f1c2b0abe1ce76a03ad9b32336a4723d8cf862 +"@sentry-internal/eslint-plugin-sdk@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/eslint-plugin-sdk@npm:10.7.0" + checksum: 9a45a13bba66b69f7db2fa5bea099eb389050015e0263b4d1707416e2310f96867a229aebaee547beb940d86190e5811dfa2593ae672c499b0f4ea44913ca29c languageName: node linkType: hard -"@sentry-internal/feedback@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/feedback@npm:9.22.0" +"@sentry-internal/feedback@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/feedback@npm:10.7.0" dependencies: - "@sentry/core": 9.22.0 - checksum: fe4eaa655915b65bb4ddc76d28c78a03a8e4150f2a12ab34a3cb70061f9f2dbbf00675f60102bf59391ffbbaa52fe3f1a71b195c7649b7947eeba9376660a73c + "@sentry/core": 10.7.0 + checksum: 5fb390b100bf7f9535b49d0fa80be3f8b0cb9325ca026697776dcc977f2e0f44ec2b42d08d18bf718fe90063ab90be1d9fe81860e91b92d5bafba27527ee746d languageName: node linkType: hard -"@sentry-internal/replay-canvas@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/replay-canvas@npm:9.22.0" +"@sentry-internal/replay-canvas@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/replay-canvas@npm:10.7.0" dependencies: - "@sentry-internal/replay": 9.22.0 - "@sentry/core": 9.22.0 - checksum: 2a6414d3d51f779110df4e40a4460d8f933f21b73e4a55440964b821d07178d1c31c67c5a992d160c40d10d588a940ebd42624058a94f5d359844de8176713e1 + "@sentry-internal/replay": 10.7.0 + "@sentry/core": 10.7.0 + checksum: 6c05d7d59343a69f7a76df392beec5e9873ab672e9db0d3bdc4b2031519299b4bcfb60fbe676c0390872dabb700adc1b6803f70c3efe592bf7474e280f7ddc30 languageName: node linkType: hard -"@sentry-internal/replay@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/replay@npm:9.22.0" +"@sentry-internal/replay@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/replay@npm:10.7.0" dependencies: - "@sentry-internal/browser-utils": 9.22.0 - "@sentry/core": 9.22.0 - checksum: 37e3b9f0db8ee70f1b16c70e07f6c7dc6599eb4f781dc6d82cfcb5c53cea8d57d62da0728da5d4ce731cb7900e555e0aae012daf5e4a8ab57aa2cf3d041b5a6c + "@sentry-internal/browser-utils": 10.7.0 + "@sentry/core": 10.7.0 + checksum: 3ccbe69a360537386f021c0a3c1b3521e7335882a93f7c84ab1ba48a9f12ee2e57807f8dbc959963f22f498db01fe17820a3dea76f4f858aaaa69e8a9bcaced4 languageName: node linkType: hard @@ -8989,12 +8989,12 @@ __metadata: languageName: node linkType: hard -"@sentry-internal/typescript@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry-internal/typescript@npm:9.22.0" +"@sentry-internal/typescript@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry-internal/typescript@npm:10.7.0" peerDependencies: typescript: ~5.0.0 - checksum: bd3ef99b75fd52103b83948830285c04b5d495507f1a15e559245547db0890d7e8a622a1e95f622dfbdbc6871502a5e68af2bf047416273d9c84b748f8733d84 + checksum: 223ea5023cd75d90d246c1d6a5ce3b17b4eeb310b0e3e7441c1daf294b4b32fdd4944c47417716c9cf1cf3bddaea773cc0ccc007ca7d4ef94c412f0b9d323f84 languageName: node linkType: hard @@ -9005,16 +9005,16 @@ __metadata: languageName: node linkType: hard -"@sentry/browser@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry/browser@npm:9.22.0" +"@sentry/browser@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry/browser@npm:10.7.0" dependencies: - "@sentry-internal/browser-utils": 9.22.0 - "@sentry-internal/feedback": 9.22.0 - "@sentry-internal/replay": 9.22.0 - "@sentry-internal/replay-canvas": 9.22.0 - "@sentry/core": 9.22.0 - checksum: 705abac1b2a5c058004938aed4f1d80e1255f560d89eead28d51c67c1ca7b53afc18d77f1fd5ffffbeca69166ed5aab2f006a2d1ebda3f73bc6be0fd4257c5d6 + "@sentry-internal/browser-utils": 10.7.0 + "@sentry-internal/feedback": 10.7.0 + "@sentry-internal/replay": 10.7.0 + "@sentry-internal/replay-canvas": 10.7.0 + "@sentry/core": 10.7.0 + checksum: 55863d8bcabc252a5c20704fa1cfc1205bf3d85724e5b1edb9efcf7e16b403c57fe4bdc432b91abb636bc0b36dfed952d5f1243041708fbc2307f2c43084721b languageName: node linkType: hard @@ -9114,6 +9114,13 @@ __metadata: languageName: node linkType: hard +"@sentry/core@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry/core@npm:10.7.0" + checksum: 597de9a110ba473cfc00fd003278d81851a1c1c69aeda555cbd7fb0ea006d267d60880207c8580e68accc91fe87f750c2aeb2b21dbaa4a0a3b30f74f39cd1eed + languageName: node + linkType: hard + "@sentry/core@npm:7.119.2": version: 7.119.2 resolution: "@sentry/core@npm:7.119.2" @@ -9124,13 +9131,6 @@ __metadata: languageName: node linkType: hard -"@sentry/core@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry/core@npm:9.22.0" - checksum: b9cfc1c3e0e5f886c8656f0b6e917dc9e4b2bd8a3f7539f44e7acd2a0dcf4bd6ddc8fdf99c69f6279cca487ccc604e16fd91d3a824bdf62954164131d4a38b34 - languageName: node - linkType: hard - "@sentry/integrations@npm:7.119.2": version: 7.119.2 resolution: "@sentry/integrations@npm:7.119.2" @@ -9164,15 +9164,15 @@ __metadata: "@expo/metro-config": ~0.20.0 "@mswjs/interceptors": ^0.25.15 "@react-native/babel-preset": 0.77.1 - "@sentry-internal/eslint-config-sdk": 9.22.0 - "@sentry-internal/eslint-plugin-sdk": 9.22.0 - "@sentry-internal/typescript": 9.22.0 + "@sentry-internal/eslint-config-sdk": 10.7.0 + "@sentry-internal/eslint-plugin-sdk": 10.7.0 + "@sentry-internal/typescript": 10.7.0 "@sentry/babel-plugin-component-annotate": 4.0.2 - "@sentry/browser": 9.22.0 + "@sentry/browser": 10.7.0 "@sentry/cli": 2.50.2 - "@sentry/core": 9.22.0 - "@sentry/react": 9.22.0 - "@sentry/types": 9.22.0 + "@sentry/core": 10.7.0 + "@sentry/react": 10.7.0 + "@sentry/types": 10.7.0 "@sentry/wizard": 6.1.0 "@testing-library/react-native": ^12.7.2 "@types/jest": ^29.5.13 @@ -9219,16 +9219,25 @@ __metadata: languageName: unknown linkType: soft -"@sentry/react@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry/react@npm:9.22.0" +"@sentry/react@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry/react@npm:10.7.0" dependencies: - "@sentry/browser": 9.22.0 - "@sentry/core": 9.22.0 + "@sentry/browser": 10.7.0 + "@sentry/core": 10.7.0 hoist-non-react-statics: ^3.3.2 peerDependencies: react: ^16.14.0 || 17.x || 18.x || 19.x - checksum: 6e70ce8dd221b71993be56b8c346d7d61a4bb8fcbc4ebbb9c920a7b3dae9306e9b1c5888b78ac54728a9f8ed8500d3f3e6afbde5b15a89bb834c9494287b58f5 + checksum: b4e33e5fef306744232012e9744945c85357d1cb9950ebb297f43535c7b93fdbe8bc881e4c502a105cd62030f82c036236cd045d22c46f5352b0caedec2d6873 + languageName: node + linkType: hard + +"@sentry/types@npm:10.7.0": + version: 10.7.0 + resolution: "@sentry/types@npm:10.7.0" + dependencies: + "@sentry/core": 10.7.0 + checksum: e4f9b92f457f42947a45688bbcdeed76a278b8e42cf4044c57f854964b04d0dc447738c09cb948bf51a1d6b353534197f153eb194d529d3a7a308d409ca56082 languageName: node linkType: hard @@ -9239,15 +9248,6 @@ __metadata: languageName: node linkType: hard -"@sentry/types@npm:9.22.0": - version: 9.22.0 - resolution: "@sentry/types@npm:9.22.0" - dependencies: - "@sentry/core": 9.22.0 - checksum: 2348ba125fe413d9c163fb1b580ea805f721d505a3beb143a908da0765bfa74ea5455a7a34ab4a5ec744b9af37aa5661f77789a6d4afeb6dd6cab94fd0b5675e - languageName: node - linkType: hard - "@sentry/utils@npm:7.119.2": version: 7.119.2 resolution: "@sentry/utils@npm:7.119.2" @@ -26666,7 +26666,7 @@ __metadata: dependencies: "@babel/preset-env": ^7.25.3 "@babel/preset-typescript": ^7.18.6 - "@sentry/core": 9.22.0 + "@sentry/core": 10.7.0 "@sentry/react-native": 7.0.0-rc.1 "@types/node": ^20.9.3 "@types/react": ^18.2.64 @@ -26734,8 +26734,8 @@ __metadata: "@react-navigation/bottom-tabs": ^6.5.12 "@react-navigation/native": ^6.1.9 "@react-navigation/stack": ^6.3.20 - "@sentry/core": 9.22.0 - "@sentry/react": 9.22.0 + "@sentry/core": 10.7.0 + "@sentry/react": 10.7.0 "@sentry/react-native": 7.0.0-rc.1 "@types/react": ^18.2.65 "@types/react-native-vector-icons": ^6.4.18 @@ -26782,7 +26782,7 @@ __metadata: "@react-navigation/native-stack": 7.3.12 "@react-navigation/stack": 7.3.1 "@sentry/babel-plugin-component-annotate": 4.0.2 - "@sentry/core": 9.22.0 + "@sentry/core": 10.7.0 "@sentry/react-native": 7.0.0-rc.1 "@shopify/flash-list": 1.8.0 "@types/jest": ^29.5.14