Skip to content

Commit 77443b3

Browse files
committed
feat(core): Deprecate logger in favor of debug
1 parent 062204a commit 77443b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+83
-112
lines changed

MIGRATION.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ These docs walk through how to migrate our JavaScript SDKs through different maj
77
- Upgrading from [SDK 7.x to 8.x](./docs/migration/v7-to-v8.md)
88
- Upgrading from [SDK 8.x to 9.x](#upgrading-from-8x-to-9x)
99

10+
# Deprecations in 9.x
11+
12+
## Deprecated `@sentry/core` SDK internal `logger` export
13+
14+
The `logger` export from `@sentry/core` has been deprecated in favor of the `debug` export. `debug` only exposes `log`, `warn`, and `error` methods but is otherwise identical to `logger`.
15+
16+
```js
17+
import { logger } from '@sentry/core';
18+
19+
// before
20+
logger.info('This is an info message');
21+
22+
// after
23+
debug.log('This is an info message');
24+
```
25+
1026
# Upgrading from 8.x to 9.x
1127

1228
Version 9 of the Sentry JavaScript SDK primarily introduces API cleanup and version support changes.

packages/core/src/breadcrumbs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getClient, getIsolationScope } from './currentScopes';
22
import type { Breadcrumb, BreadcrumbHint } from './types-hoist/breadcrumb';
3-
import { consoleSandbox } from './utils/logger';
3+
import { consoleSandbox } from './utils/debug-logger';
44
import { dateTimestampInSeconds } from './utils/time';
55

66
/**

packages/core/src/carrier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AsyncContextStrategy } from './asyncContext/types';
33
import type { Client } from './client';
44
import type { Scope } from './scope';
55
import type { SerializedLog } from './types-hoist/log';
6-
import type { Logger } from './utils/logger';
6+
import type { Logger } from './utils/debug-logger';
77
import { SDK_VERSION } from './utils/version';
88
import { GLOBAL_OBJ } from './utils/worldwide';
99

packages/core/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ import type { Span, SpanAttributes, SpanContextData, SpanJSON } from './types-ho
3333
import type { StartSpanOptions } from './types-hoist/startSpanOptions';
3434
import type { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
3535
import { createClientReportEnvelope } from './utils/clientreport';
36+
import { debug } from './utils/debug-logger';
3637
import { dsnToString, makeDsn } from './utils/dsn';
3738
import { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope';
3839
import { getPossibleEventMessages } from './utils/eventUtils';
3940
import { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is';
40-
import { debug } from './utils/logger';
4141
import { merge } from './utils/merge';
4242
import { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';
4343
import { parseSampleRate } from './utils/parseSampleRate';

packages/core/src/eventProcessors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DEBUG_BUILD } from './debug-build';
22
import type { Event, EventHint } from './types-hoist/event';
33
import type { EventProcessor } from './types-hoist/eventprocessor';
4+
import { debug } from './utils/debug-logger';
45
import { isThenable } from './utils/is';
5-
import { debug } from './utils/logger';
66
import { SyncPromise } from './utils/syncpromise';
77

88
/**

packages/core/src/exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import type { Primitive } from './types-hoist/misc';
1010
import type { Session, SessionContext } from './types-hoist/session';
1111
import type { SeverityLevel } from './types-hoist/severity';
1212
import type { User } from './types-hoist/user';
13+
import { debug } from './utils/debug-logger';
1314
import { isThenable } from './utils/is';
14-
import { debug } from './utils/logger';
1515
import { uuid4 } from './utils/misc';
1616
import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
1717
import { parseEventHintOrCaptureContext } from './utils/prepareEvent';

packages/core/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ export {
165165
isVueViewModel,
166166
} from './utils/is';
167167
export { isBrowser } from './utils/isBrowser';
168-
export { CONSOLE_LEVELS, consoleSandbox, debug, logger, originalConsoleMethods } from './utils/logger';
169-
export type { Logger } from './utils/logger';
168+
// eslint-disable-next-line deprecation/deprecation
169+
export { CONSOLE_LEVELS, consoleSandbox, debug, logger, originalConsoleMethods } from './utils/debug-logger';
170+
// eslint-disable-next-line deprecation/deprecation
171+
export type { Logger } from './utils/debug-logger';
170172
export {
171173
addContextToFrame,
172174
addExceptionMechanism,

packages/core/src/instrument/console.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
/* eslint-disable @typescript-eslint/ban-types */
33
import type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';
4-
import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/logger';
4+
import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';
55
import { fill } from '../utils/object';
66
import { GLOBAL_OBJ } from '../utils/worldwide';
77
import { addHandler, maybeInstrument, triggerHandlers } from './handlers';

packages/core/src/instrument/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DEBUG_BUILD } from '../debug-build';
2-
import { debug } from '../utils/logger';
2+
import { debug } from '../utils/debug-logger';
33
import { getFunctionName } from '../utils/stacktrace';
44

55
export type InstrumentHandlerType =

packages/core/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DEBUG_BUILD } from './debug-build';
44
import type { Event, EventHint } from './types-hoist/event';
55
import type { Integration, IntegrationFn } from './types-hoist/integration';
66
import type { Options } from './types-hoist/options';
7-
import { debug } from './utils/logger';
7+
import { debug } from './utils/debug-logger';
88

99
export const installedIntegrations: string[] = [];
1010

0 commit comments

Comments
 (0)