Skip to content

Commit bcb7422

Browse files
authored
ref(vercel-edge): Use debug in vercel edge sdk (#16912)
resolves #16911
1 parent cebf518 commit bcb7422

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

packages/vercel-edge/src/sdk.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Client, Integration, Options } from '@sentry/core';
1010
import {
1111
consoleIntegration,
1212
createStackParser,
13+
debug,
1314
dedupeIntegration,
1415
functionToStringIntegration,
1516
getCurrentScope,
@@ -18,7 +19,6 @@ import {
1819
hasSpansEnabled,
1920
inboundFiltersIntegration,
2021
linkedErrorsIntegration,
21-
logger,
2222
nodeStackLineParser,
2323
requestDataIntegration,
2424
SDK_VERSION,
@@ -135,14 +135,14 @@ function validateOpenTelemetrySetup(): void {
135135

136136
for (const k of required) {
137137
if (!setup.includes(k)) {
138-
logger.error(
138+
debug.error(
139139
`You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,
140140
);
141141
}
142142
}
143143

144144
if (!setup.includes('SentrySampler')) {
145-
logger.warn(
145+
debug.warn(
146146
'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.',
147147
);
148148
}
@@ -182,19 +182,21 @@ export function setupOtel(client: VercelEdgeClient): void {
182182
}
183183

184184
/**
185-
* Setup the OTEL logger to use our own logger.
185+
* Setup the OTEL logger to use our own debug logger.
186186
*/
187187
function setupOpenTelemetryLogger(): void {
188-
const otelLogger = new Proxy(logger as typeof logger & { verbose: (typeof logger)['debug'] }, {
189-
get(target, prop, receiver) {
190-
const actualProp = prop === 'verbose' ? 'debug' : prop;
191-
return Reflect.get(target, actualProp, receiver);
192-
},
193-
});
194-
195188
// Disable diag, to ensure this works even if called multiple times
196189
diag.disable();
197-
diag.setLogger(otelLogger, DiagLogLevel.DEBUG);
190+
diag.setLogger(
191+
{
192+
error: debug.error,
193+
warn: debug.warn,
194+
info: debug.log,
195+
debug: debug.log,
196+
verbose: debug.log,
197+
},
198+
DiagLogLevel.DEBUG,
199+
);
198200
}
199201

200202
/**

packages/vercel-edge/src/vendored/async-local-storage-context-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import type { Context } from '@opentelemetry/api';
2929
import { ROOT_CONTEXT } from '@opentelemetry/api';
30-
import { GLOBAL_OBJ, logger } from '@sentry/core';
30+
import { debug, GLOBAL_OBJ } from '@sentry/core';
3131
import type { AsyncLocalStorage } from 'async_hooks';
3232
import { DEBUG_BUILD } from '../debug-build';
3333
import { AbstractAsyncHooksContextManager } from './abstract-async-hooks-context-manager';
@@ -42,7 +42,7 @@ export class AsyncLocalStorageContextManager extends AbstractAsyncHooksContextMa
4242

4343
if (!MaybeGlobalAsyncLocalStorageConstructor) {
4444
DEBUG_BUILD &&
45-
logger.warn(
45+
debug.warn(
4646
"Tried to register AsyncLocalStorage async context strategy in a runtime that doesn't support AsyncLocalStorage.",
4747
);
4848

0 commit comments

Comments
 (0)