diff --git a/packages/remix/src/client/index.ts b/packages/remix/src/client/index.ts index fc77db42ad3d..6eb908457432 100644 --- a/packages/remix/src/client/index.ts +++ b/packages/remix/src/client/index.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { DEBUG_BUILD } from '../utils/debug-build'; export * from '@sentry/react'; @@ -17,7 +17,7 @@ export { browserTracingIntegration } from './browserTracingIntegration'; */ export async function captureRemixServerException(err: unknown, name: string, request: Request): Promise { DEBUG_BUILD && - logger.warn( + debug.warn( '`captureRemixServerException` is a server-only function and should not be called in the browser. ' + 'This function is a no-op in the browser environment.', ); diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index 66927deb4c9a..18b923c8b6d4 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -1,10 +1,10 @@ import type { Client, StartSpanOptions } from '@sentry/core'; import { + debug, getActiveSpan, getCurrentScope, getRootSpan, isNodeEnv, - logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; @@ -119,7 +119,7 @@ export function withSentry

, R extends React.Co if (!_useEffect || !_useLocation || !_useMatches) { DEBUG_BUILD && !isNodeEnv() && - logger.warn('Remix SDK was unable to wrap your root because of one or more missing parameters.'); + debug.warn('Remix SDK was unable to wrap your root because of one or more missing parameters.'); // @ts-expect-error Setting more specific React Component typing for `R` generic above // will break advanced type inference done by react router params diff --git a/packages/remix/src/server/errors.ts b/packages/remix/src/server/errors.ts index 0e26242a0164..d21e9d57d42c 100644 --- a/packages/remix/src/server/errors.ts +++ b/packages/remix/src/server/errors.ts @@ -11,9 +11,9 @@ import type { RequestEventData, Span } from '@sentry/core'; import { addExceptionMechanism, captureException, + debug, getClient, handleCallbackErrors, - logger, objectify, winterCGRequestToRequestData, } from '@sentry/core'; @@ -46,7 +46,7 @@ export async function captureRemixServerException(err: unknown, name: string, re // Skip capturing if the request is aborted as Remix docs suggest // Ref: https://remix.run/docs/en/main/file-conventions/entry.server#handleerror if (request.signal.aborted) { - DEBUG_BUILD && logger.warn('Skipping capture of aborted request'); + DEBUG_BUILD && debug.warn('Skipping capture of aborted request'); return; } @@ -55,7 +55,7 @@ export async function captureRemixServerException(err: unknown, name: string, re try { normalizedRequest = winterCGRequestToRequestData(request); } catch (e) { - DEBUG_BUILD && logger.warn('Failed to normalize Remix request'); + DEBUG_BUILD && debug.warn('Failed to normalize Remix request'); } const objectifiedErr = objectify(err); diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 4f67f2ae8b3d..f93c195df355 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -16,6 +16,7 @@ import type { import type { RequestEventData, Span, TransactionSource, WrappedFunction } from '@sentry/core'; import { continueTrace, + debug, fill, getActiveSpan, getClient, @@ -24,7 +25,6 @@ import { hasSpansEnabled, isNodeEnv, loadModule, - logger, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -73,7 +73,7 @@ export function sentryHandleError(err: unknown, { request }: DataFunctionArgs): } captureRemixServerException(err, 'remix.server.handleError', request).then(null, e => { - DEBUG_BUILD && logger.warn('Failed to capture Remix Server exception.', e); + DEBUG_BUILD && debug.warn('Failed to capture Remix Server exception.', e); }); } @@ -220,7 +220,7 @@ function makeWrappedRootLoader() { // We skip injection of trace and baggage in those cases. // For `redirect`, a valid internal redirection target will have the trace and baggage injected. if (isRedirectResponse(res) || isCatchResponse(res)) { - DEBUG_BUILD && logger.warn('Skipping injection of trace and baggage as the response does not have a body'); + DEBUG_BUILD && debug.warn('Skipping injection of trace and baggage as the response does not have a body'); return res; } else { const data = await extractData(res); @@ -235,7 +235,7 @@ function makeWrappedRootLoader() { }, ); } else { - DEBUG_BUILD && logger.warn('Skipping injection of trace and baggage as the response body is not an object'); + DEBUG_BUILD && debug.warn('Skipping injection of trace and baggage as the response body is not an object'); return res; } } @@ -289,7 +289,7 @@ function wrapRequestHandler ServerBuild | Promise try { normalizedRequest = winterCGRequestToRequestData(request); } catch (e) { - DEBUG_BUILD && logger.warn('Failed to normalize Remix request'); + DEBUG_BUILD && debug.warn('Failed to normalize Remix request'); } if (options?.instrumentTracing && resolvedRoutes) { @@ -447,7 +447,7 @@ export function instrumentServer(options?: { instrumentTracing?: boolean }): voi }>('@remix-run/server-runtime', module); if (!pkg) { - DEBUG_BUILD && logger.warn('Remix SDK was unable to require `@remix-run/server-runtime` package.'); + DEBUG_BUILD && debug.warn('Remix SDK was unable to require `@remix-run/server-runtime` package.'); return; } diff --git a/packages/remix/src/server/sdk.ts b/packages/remix/src/server/sdk.ts index 816e5083aa26..145cb8a66b47 100644 --- a/packages/remix/src/server/sdk.ts +++ b/packages/remix/src/server/sdk.ts @@ -1,5 +1,5 @@ import type { Integration } from '@sentry/core'; -import { applySdkMetadata, logger } from '@sentry/core'; +import { applySdkMetadata, debug } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations as getDefaultNodeIntegrations, init as nodeInit, isInitialized } from '@sentry/node'; import { DEBUG_BUILD } from '../utils/debug-build'; @@ -26,7 +26,7 @@ export function init(options: RemixOptions): NodeClient | undefined { applySdkMetadata(options, 'remix', ['remix', 'node']); if (isInitialized()) { - DEBUG_BUILD && logger.log('SDK already initialized'); + DEBUG_BUILD && debug.log('SDK already initialized'); return; } diff --git a/packages/remix/src/utils/utils.ts b/packages/remix/src/utils/utils.ts index 62fee4b20d61..5485cff5e0a3 100644 --- a/packages/remix/src/utils/utils.ts +++ b/packages/remix/src/utils/utils.ts @@ -1,7 +1,7 @@ import type { ActionFunctionArgs, LoaderFunctionArgs, ServerBuild } from '@remix-run/node'; import type { AgnosticRouteObject } from '@remix-run/router'; import type { Span, TransactionSource } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import { DEBUG_BUILD } from './debug-build'; import { getRequestMatch, matchServerRoutes } from './vendor/response'; @@ -39,7 +39,7 @@ export async function storeFormDataKeys( } }); } catch (e) { - DEBUG_BUILD && logger.warn('Failed to read FormData from request', e); + DEBUG_BUILD && debug.warn('Failed to read FormData from request', e); } } diff --git a/packages/remix/test/integration/test/server/utils/helpers.ts b/packages/remix/test/integration/test/server/utils/helpers.ts index f273aaffc73a..af9a4934ee1e 100644 --- a/packages/remix/test/integration/test/server/utils/helpers.ts +++ b/packages/remix/test/integration/test/server/utils/helpers.ts @@ -2,7 +2,7 @@ import * as http from 'http'; import { AddressInfo } from 'net'; import * as path from 'path'; import { createRequestHandler } from '@remix-run/express'; -import { logger } from '@sentry/core'; +import { debug } from '@sentry/core'; import type { EnvelopeItemType, Event, TransactionEvent } from '@sentry/core'; /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as Sentry from '@sentry/node'; @@ -46,7 +46,7 @@ async function makeRequest( } catch (e) { // We sometimes expect the request to fail, but not the test. // So, we do nothing. - logger.warn(e); + debug.warn(e); } } @@ -195,7 +195,7 @@ class TestEnv { this._closeServer() .catch(e => { - logger.warn(e); + debug.warn(e); }) .finally(() => { resolve(envelopes);