Skip to content

Commit 369e5c0

Browse files
ref(react): Use debug instead of logger (#16958)
resolves #16940 Migrates `@sentry/react` to use the `debug` utility instead of `logger` from `@sentry/core`. This change aligns with the ongoing effort to streamline logging utilities within the SDK, moving towards a more focused `debug` function. --- Before submitting a pull request, please take a look at our [Contributing](https://github.com/getsentry/sentry-javascript/blob/master/CONTRIBUTING.md) guidelines and verify: - [x] If you've added code that should be tested, please add tests. - [x] Ensure your code lints and the test suite passes (`yarn lint`) & (`yarn test`). --------- Co-authored-by: Cursor Agent <[email protected]>
1 parent 2912474 commit 369e5c0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReportDialogOptions } from '@sentry/browser';
22
import { getClient, showReportDialog, withScope } from '@sentry/browser';
33
import type { Scope } from '@sentry/core';
4-
import { logger } from '@sentry/core';
4+
import { debug } from '@sentry/core';
55
import * as React from 'react';
66
import { DEBUG_BUILD } from './debug-build';
77
import { captureReactException } from './error';
@@ -207,7 +207,7 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
207207
}
208208

209209
if (fallback) {
210-
DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');
210+
DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');
211211
}
212212

213213
// Fail gracefully if no fallback provided or is not valid

packages/react/src/reactrouterv6-compat-utils.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {
1010
} from '@sentry/browser';
1111
import type { Client, Integration, Span, TransactionSource } from '@sentry/core';
1212
import {
13+
debug,
1314
getActiveSpan,
1415
getClient,
1516
getCurrentScope,
1617
getRootSpan,
17-
logger,
1818
SEMANTIC_ATTRIBUTE_SENTRY_OP,
1919
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
2020
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
@@ -75,7 +75,7 @@ export function createV6CompatibleWrapCreateBrowserRouter<
7575
): CreateRouterFunction<TState, TRouter> {
7676
if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
7777
DEBUG_BUILD &&
78-
logger.warn(
78+
debug.warn(
7979
`reactRouterV${version}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`,
8080
);
8181

@@ -147,7 +147,7 @@ export function createV6CompatibleWrapCreateMemoryRouter<
147147
): CreateRouterFunction<TState, TRouter> {
148148
if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
149149
DEBUG_BUILD &&
150-
logger.warn(
150+
debug.warn(
151151
`reactRouterV${version}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`,
152152
);
153153

@@ -271,7 +271,7 @@ export function createReactRouterV6CompatibleTracingIntegration(
271271
export function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, version: V6CompatibleVersion): UseRoutes {
272272
if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
273273
DEBUG_BUILD &&
274-
logger.warn(
274+
debug.warn(
275275
'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',
276276
);
277277

@@ -632,7 +632,7 @@ export function createV6CompatibleWithSentryReactRouterRouting<P extends Record<
632632
): R {
633633
if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {
634634
DEBUG_BUILD &&
635-
logger.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
635+
debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
636636
useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.
637637
createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);
638638

0 commit comments

Comments
 (0)