diff --git a/dev-packages/browser-integration-tests/suites/public-api/logger/init.js b/dev-packages/browser-integration-tests/suites/public-api/logger/init.js index 27397e0f90ce..8026df91ea46 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/logger/init.js +++ b/dev-packages/browser-integration-tests/suites/public-api/logger/init.js @@ -4,7 +4,5 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', - _experiments: { - enableLogs: true, - }, + enableLogs: true, }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/logger/integration/init.js b/dev-packages/browser-integration-tests/suites/public-api/logger/integration/init.js index e0ceaaebf017..809b78739e77 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/logger/integration/init.js +++ b/dev-packages/browser-integration-tests/suites/public-api/logger/integration/init.js @@ -4,8 +4,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', - _experiments: { - enableLogs: true, - }, + enableLogs: true, integrations: [Sentry.consoleLoggingIntegration()], }); diff --git a/dev-packages/e2e-tests/test-applications/node-express/src/app.ts b/dev-packages/e2e-tests/test-applications/node-express/src/app.ts index 9f7b0055b66d..0ac843b5409e 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/src/app.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/src/app.ts @@ -13,9 +13,7 @@ Sentry.init({ debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1, - _experiments: { - enableLogs: true, - }, + enableLogs: true, }); import { TRPCError, initTRPC } from '@trpc/server'; diff --git a/dev-packages/node-core-integration-tests/suites/winston/subject.ts b/dev-packages/node-core-integration-tests/suites/winston/subject.ts index c8840b855f9b..3c31ddb63fa5 100644 --- a/dev-packages/node-core-integration-tests/suites/winston/subject.ts +++ b/dev-packages/node-core-integration-tests/suites/winston/subject.ts @@ -8,9 +8,7 @@ const client = Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0.0', environment: 'test', - _experiments: { - enableLogs: true, - }, + enableLogs: true, transport: loggingTransport, }); diff --git a/dev-packages/node-integration-tests/suites/winston/subject.ts b/dev-packages/node-integration-tests/suites/winston/subject.ts index ac70abc50d80..1047f2f1cd47 100644 --- a/dev-packages/node-integration-tests/suites/winston/subject.ts +++ b/dev-packages/node-integration-tests/suites/winston/subject.ts @@ -7,9 +7,7 @@ Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0.0', environment: 'test', - _experiments: { - enableLogs: true, - }, + enableLogs: true, transport: loggingTransport, }); diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 5c50e53e708b..b6c05afe70f7 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -85,8 +85,7 @@ export class BrowserClient extends Client { super(opts); - const { sendDefaultPii, sendClientReports, _experiments } = this._options; - const enableLogs = _experiments?.enableLogs; + const { sendDefaultPii, sendClientReports, enableLogs } = this._options; if (WINDOW.document && (sendClientReports || enableLogs)) { WINDOW.document.addEventListener('visibilitychange', () => { diff --git a/packages/browser/src/log.ts b/packages/browser/src/log.ts index ef2614b81f55..c21477e378b3 100644 --- a/packages/browser/src/log.ts +++ b/packages/browser/src/log.ts @@ -19,7 +19,7 @@ function captureLog( } /** - * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `trace` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }. @@ -48,7 +48,7 @@ export function trace(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `debug` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }. @@ -78,7 +78,7 @@ export function debug(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `info` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }. @@ -108,7 +108,7 @@ export function info(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `warn` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }. @@ -139,7 +139,7 @@ export function warn(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `error` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }. @@ -171,7 +171,7 @@ export function error(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `fatal` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }. diff --git a/packages/browser/test/client.test.ts b/packages/browser/test/client.test.ts index c0f4e649501a..2197b6ed03c0 100644 --- a/packages/browser/test/client.test.ts +++ b/packages/browser/test/client.test.ts @@ -27,7 +27,6 @@ describe('BrowserClient', () => { it('does not flush logs when logs are disabled', () => { client = new BrowserClient( getDefaultBrowserClientOptions({ - _experiments: { enableLogs: false }, sendClientReports: true, }), ); @@ -50,7 +49,7 @@ describe('BrowserClient', () => { vi.useFakeTimers(); client = new BrowserClient( getDefaultBrowserClientOptions({ - _experiments: { enableLogs: true }, + enableLogs: true, sendClientReports: true, }), ); diff --git a/packages/browser/test/log.test.ts b/packages/browser/test/log.test.ts index 68c87069966c..0967d38531dd 100644 --- a/packages/browser/test/log.test.ts +++ b/packages/browser/test/log.test.ts @@ -42,9 +42,7 @@ describe('Logger', () => { init({ dsn, transport: makeSimpleTransport, - _experiments: { - enableLogs: true, - }, + enableLogs: true, }); }); diff --git a/packages/cloudflare/src/logs/exports.ts b/packages/cloudflare/src/logs/exports.ts index ef2614b81f55..c21477e378b3 100644 --- a/packages/cloudflare/src/logs/exports.ts +++ b/packages/cloudflare/src/logs/exports.ts @@ -19,7 +19,7 @@ function captureLog( } /** - * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `trace` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }. @@ -48,7 +48,7 @@ export function trace(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `debug` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }. @@ -78,7 +78,7 @@ export function debug(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `info` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }. @@ -108,7 +108,7 @@ export function info(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `warn` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }. @@ -139,7 +139,7 @@ export function warn(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `error` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }. @@ -171,7 +171,7 @@ export function error(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `fatal` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }. diff --git a/packages/core/src/logs/console-integration.ts b/packages/core/src/logs/console-integration.ts index d2cdc8fa1d48..a69d406a659c 100644 --- a/packages/core/src/logs/console-integration.ts +++ b/packages/core/src/logs/console-integration.ts @@ -33,9 +33,9 @@ const _consoleLoggingIntegration = ((options: Partial = { return { name: INTEGRATION_NAME, setup(client) { - const { _experiments, normalizeDepth = 3, normalizeMaxBreadth = 1_000 } = client.getOptions(); - if (!_experiments?.enableLogs) { - DEBUG_BUILD && debug.warn('`_experiments.enableLogs` is not enabled, ConsoleLogs integration disabled'); + const { enableLogs, normalizeDepth = 3, normalizeMaxBreadth = 1_000 } = client.getOptions(); + if (!enableLogs) { + DEBUG_BUILD && debug.warn('`enableLogs` is not enabled, ConsoleLogs integration disabled'); return; } @@ -69,7 +69,7 @@ const _consoleLoggingIntegration = ((options: Partial = { }) satisfies IntegrationFn; /** - * Captures calls to the `console` API as logs in Sentry. Requires `_experiments.enableLogs` to be enabled. + * Captures calls to the `console` API as logs in Sentry. Requires the `enableLogs` option to be enabled. * * @experimental This feature is experimental and may be changed or removed in future versions. * @@ -83,6 +83,7 @@ const _consoleLoggingIntegration = ((options: Partial = { * import * as Sentry from '@sentry/browser'; * * Sentry.init({ + * enableLogs: true, * integrations: [Sentry.consoleLoggingIntegration({ levels: ['error', 'warn'] })], * }); * ``` diff --git a/packages/core/src/logs/exports.ts b/packages/core/src/logs/exports.ts index 23246a7e1251..79dfedf4ec87 100644 --- a/packages/core/src/logs/exports.ts +++ b/packages/core/src/logs/exports.ts @@ -124,8 +124,7 @@ export function _INTERNAL_captureLog( return; } - const { _experiments, release, environment } = client.getOptions(); - const { enableLogs = false, beforeSendLog } = _experiments ?? {}; + const { release, environment, enableLogs = false, beforeSendLog } = client.getOptions(); if (!enableLogs) { DEBUG_BUILD && debug.warn('logging option not enabled, log will not be captured.'); return; diff --git a/packages/core/src/server-runtime-client.ts b/packages/core/src/server-runtime-client.ts index 246e0a88bc51..d9c44ed7149d 100644 --- a/packages/core/src/server-runtime-client.ts +++ b/packages/core/src/server-runtime-client.ts @@ -49,7 +49,7 @@ export class ServerRuntimeClient< this._logWeight = 0; - if (this._options._experiments?.enableLogs) { + if (this._options.enableLogs) { // eslint-disable-next-line @typescript-eslint/no-this-alias const client = this; diff --git a/packages/core/src/types-hoist/options.ts b/packages/core/src/types-hoist/options.ts index a4119ed42a6e..7d542b1cb655 100644 --- a/packages/core/src/types-hoist/options.ts +++ b/packages/core/src/types-hoist/options.ts @@ -246,25 +246,6 @@ export interface ClientOptions Log | null; }; /** @@ -328,6 +309,27 @@ export interface ClientOptions Log | null; + /** * Function to compute tracing sample rate dynamically and filter unwanted traces. * diff --git a/packages/core/test/lib/logs/exports.test.ts b/packages/core/test/lib/logs/exports.test.ts index 536ae9a2adfd..4fd01a16a304 100644 --- a/packages/core/test/lib/logs/exports.test.ts +++ b/packages/core/test/lib/logs/exports.test.ts @@ -82,7 +82,7 @@ describe('logAttributeToSerializedLogAttribute', () => { describe('_INTERNAL_captureLog', () => { it('captures and sends logs', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); _INTERNAL_captureLog({ level: 'info', message: 'test log message' }, client, undefined); @@ -99,7 +99,7 @@ describe('_INTERNAL_captureLog', () => { ); }); - it('does not capture logs when enableLogs experiment is not enabled', () => { + it('does not capture logs when enableLogs is not enabled', () => { const logWarnSpy = vi.spyOn(loggerModule.debug, 'warn').mockImplementation(() => undefined); const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN }); const client = new TestClient(options); @@ -113,7 +113,7 @@ describe('_INTERNAL_captureLog', () => { }); it('includes trace context when available', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); const scope = new Scope(); scope.setPropagationContext({ @@ -134,7 +134,7 @@ describe('_INTERNAL_captureLog', () => { it('includes release and environment in log attributes when available', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, release: '1.0.0', environment: 'test', }); @@ -158,7 +158,7 @@ describe('_INTERNAL_captureLog', () => { it('includes SDK metadata in log attributes when available', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); const client = new TestClient(options); // Mock getSdkMetadata to return SDK info @@ -187,7 +187,7 @@ describe('_INTERNAL_captureLog', () => { it('does not include SDK metadata in log attributes when not available', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); const client = new TestClient(options); // Mock getSdkMetadata to return no SDK info @@ -205,7 +205,7 @@ describe('_INTERNAL_captureLog', () => { }); it('includes custom attributes in log', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); _INTERNAL_captureLog( @@ -232,7 +232,7 @@ describe('_INTERNAL_captureLog', () => { }); it('flushes logs buffer when it reaches max size', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); // Fill the buffer to max size (100 is the MAX_LOG_BUFFER_SIZE constant in client.ts) @@ -249,7 +249,7 @@ describe('_INTERNAL_captureLog', () => { }); it('does not flush logs buffer when it is empty', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); const mockSendEnvelope = vi.spyOn(client as any, 'sendEnvelope').mockImplementation(() => {}); _INTERNAL_flushLogsBuffer(client); @@ -257,7 +257,7 @@ describe('_INTERNAL_captureLog', () => { }); it('handles parameterized strings correctly', () => { - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); const parameterizedMessage = fmt`Hello ${'John'}, welcome to ${'Sentry'}`; @@ -290,7 +290,8 @@ describe('_INTERNAL_captureLog', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true, beforeSendLog }, + enableLogs: true, + beforeSendLog, }); const client = new TestClient(options); @@ -336,7 +337,8 @@ describe('_INTERNAL_captureLog', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true, beforeSendLog }, + enableLogs: true, + beforeSendLog, }); const client = new TestClient(options); @@ -360,7 +362,7 @@ describe('_INTERNAL_captureLog', () => { it('emits beforeCaptureLog and afterCaptureLog events', () => { const beforeCaptureLogSpy = vi.spyOn(TestClient.prototype, 'emit'); - const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, _experiments: { enableLogs: true } }); + const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true }); const client = new TestClient(options); const log: Log = { @@ -380,7 +382,7 @@ describe('_INTERNAL_captureLog', () => { it('includes user data in log attributes', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); const client = new TestClient(options); const scope = new Scope(); @@ -412,7 +414,7 @@ describe('_INTERNAL_captureLog', () => { it('includes partial user data when only some fields are available', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -436,7 +438,7 @@ describe('_INTERNAL_captureLog', () => { it('includes user email and username without id', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -465,7 +467,7 @@ describe('_INTERNAL_captureLog', () => { it('does not include user data when user object is empty', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -481,7 +483,7 @@ describe('_INTERNAL_captureLog', () => { it('combines user data with other log attributes', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, release: '1.0.0', environment: 'test', @@ -535,7 +537,7 @@ describe('_INTERNAL_captureLog', () => { it('handles user data with non-string values', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -564,7 +566,7 @@ describe('_INTERNAL_captureLog', () => { it('preserves existing user attributes in log and does not override them', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -607,7 +609,7 @@ describe('_INTERNAL_captureLog', () => { it('only adds scope user data for attributes that do not already exist', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, sendDefaultPii: true, }); const client = new TestClient(options); @@ -656,7 +658,7 @@ describe('_INTERNAL_captureLog', () => { it('overrides user-provided system attributes with SDK values', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, release: 'sdk-release-1.0.0', environment: 'sdk-environment', }); diff --git a/packages/core/test/lib/server-runtime-client.test.ts b/packages/core/test/lib/server-runtime-client.test.ts index d5b9dc33681d..708ac8716070 100644 --- a/packages/core/test/lib/server-runtime-client.test.ts +++ b/packages/core/test/lib/server-runtime-client.test.ts @@ -211,7 +211,7 @@ describe('ServerRuntimeClient', () => { it('flushes logs when weight exceeds 800KB', () => { const options = getDefaultClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); client = new ServerRuntimeClient(options); @@ -228,7 +228,7 @@ describe('ServerRuntimeClient', () => { it('accumulates log weight without flushing when under threshold', () => { const options = getDefaultClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); client = new ServerRuntimeClient(options); @@ -245,7 +245,7 @@ describe('ServerRuntimeClient', () => { it('flushes logs on flush event', () => { const options = getDefaultClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); client = new ServerRuntimeClient(options); @@ -265,7 +265,6 @@ describe('ServerRuntimeClient', () => { it('does not flush logs when logs are disabled', () => { const options = getDefaultClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: false }, }); client = new ServerRuntimeClient(options); @@ -282,7 +281,7 @@ describe('ServerRuntimeClient', () => { it('flushes logs when flush event is triggered', () => { const options = getDefaultClientOptions({ dsn: PUBLIC_DSN, - _experiments: { enableLogs: true }, + enableLogs: true, }); client = new ServerRuntimeClient(options); diff --git a/packages/node-core/src/integrations/winston.ts b/packages/node-core/src/integrations/winston.ts index a485a6c56431..a58a3ea31ad0 100644 --- a/packages/node-core/src/integrations/winston.ts +++ b/packages/node-core/src/integrations/winston.ts @@ -28,7 +28,7 @@ interface WinstonTransportOptions { } /** - * Creates a new Sentry Winston transport that fowards logs to Sentry. Requires `_experiments.enableLogs` to be enabled. + * Creates a new Sentry Winston transport that fowards logs to Sentry. Requires the `enableLogs` option to be enabled. * * Supports Winston 3.x.x. * diff --git a/packages/node-core/src/logs/exports.ts b/packages/node-core/src/logs/exports.ts index c18b69f6770a..665d4d78d9ad 100644 --- a/packages/node-core/src/logs/exports.ts +++ b/packages/node-core/src/logs/exports.ts @@ -1,7 +1,7 @@ import { type CaptureLogArgs, captureLog } from './capture'; /** - * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `trace` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * @@ -28,7 +28,7 @@ export function trace(...args: CaptureLogArgs): void { } /** - * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `debug` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * @@ -55,7 +55,7 @@ export function debug(...args: CaptureLogArgs): void { } /** - * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `info` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * @@ -82,7 +82,7 @@ export function info(...args: CaptureLogArgs): void { } /** - * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `warn` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * @@ -110,7 +110,7 @@ export function warn(...args: CaptureLogArgs): void { } /** - * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `error` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * @@ -138,7 +138,7 @@ export function error(...args: CaptureLogArgs): void { } /** - * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `fatal` level. Requires the `enableLogs` option to be enabled. * * You can either pass a message and attributes or a message template, params and attributes. * diff --git a/packages/node-core/src/sdk/client.ts b/packages/node-core/src/sdk/client.ts index 50b0d4d92b6e..c17ee22d71b4 100644 --- a/packages/node-core/src/sdk/client.ts +++ b/packages/node-core/src/sdk/client.ts @@ -45,7 +45,7 @@ export class NodeClient extends ServerRuntimeClient { super(clientOptions); - if (this.getOptions()._experiments?.enableLogs) { + if (this.getOptions().enableLogs) { this._logOnExitFlushListener = () => { _INTERNAL_flushLogsBuffer(this); }; diff --git a/packages/node-core/test/sdk/client.test.ts b/packages/node-core/test/sdk/client.test.ts index f053b1ba7e0e..7f57d4772212 100644 --- a/packages/node-core/test/sdk/client.test.ts +++ b/packages/node-core/test/sdk/client.test.ts @@ -296,7 +296,7 @@ describe('NodeClient', () => { describe('log capture', () => { it('adds server name to log attributes', () => { - const options = getDefaultNodeClientOptions({ _experiments: { enableLogs: true } }); + const options = getDefaultNodeClientOptions({ enableLogs: true }); const client = new NodeClient(options); const log: Log = { level: 'info', message: 'test message', attributes: {} }; @@ -309,7 +309,7 @@ describe('NodeClient', () => { it('preserves existing log attributes', () => { const serverName = 'test-server'; - const options = getDefaultNodeClientOptions({ serverName, _experiments: { enableLogs: true } }); + const options = getDefaultNodeClientOptions({ serverName, enableLogs: true }); const client = new NodeClient(options); const log: Log = { level: 'info', message: 'test message', attributes: { 'existing.attr': 'value' } }; diff --git a/packages/node/test/sdk/client.test.ts b/packages/node/test/sdk/client.test.ts index f053b1ba7e0e..7f57d4772212 100644 --- a/packages/node/test/sdk/client.test.ts +++ b/packages/node/test/sdk/client.test.ts @@ -296,7 +296,7 @@ describe('NodeClient', () => { describe('log capture', () => { it('adds server name to log attributes', () => { - const options = getDefaultNodeClientOptions({ _experiments: { enableLogs: true } }); + const options = getDefaultNodeClientOptions({ enableLogs: true }); const client = new NodeClient(options); const log: Log = { level: 'info', message: 'test message', attributes: {} }; @@ -309,7 +309,7 @@ describe('NodeClient', () => { it('preserves existing log attributes', () => { const serverName = 'test-server'; - const options = getDefaultNodeClientOptions({ serverName, _experiments: { enableLogs: true } }); + const options = getDefaultNodeClientOptions({ serverName, enableLogs: true }); const client = new NodeClient(options); const log: Log = { level: 'info', message: 'test message', attributes: { 'existing.attr': 'value' } }; diff --git a/packages/pino-transport/README.md b/packages/pino-transport/README.md index 0bb6aeed81ed..fdc077aa2b01 100644 --- a/packages/pino-transport/README.md +++ b/packages/pino-transport/README.md @@ -30,7 +30,7 @@ pnpm add @sentry/pino-transport pino - Node.js 18+ - Pino v8 or v9 -- `@sentry/node` SDK with `_experiments.enableLogs: true` +- `@sentry/node` SDK with `enableLogs: true` ## Setup @@ -41,9 +41,7 @@ import * as Sentry from '@sentry/node'; Sentry.init({ dsn: 'YOUR_DSN', - _experiments: { - enableLogs: true, - }, + enableLogs: true, }); ``` @@ -252,7 +250,7 @@ const logger = pino({ ### Logs not appearing in Sentry -1. Ensure `_experiments.enableLogs: true` is set in your Sentry configuration. +1. Ensure `enableLogs: true` is set in your Sentry configuration. 2. Check that your DSN is correct and the SDK is properly initialized. 3. Verify the log level is included in the `levels` configuration. 4. Check your Sentry organization stats page to see if logs are being received by Sentry. diff --git a/packages/pino-transport/src/index.ts b/packages/pino-transport/src/index.ts index 7bff4dc35327..986c7e892fc2 100644 --- a/packages/pino-transport/src/index.ts +++ b/packages/pino-transport/src/index.ts @@ -84,7 +84,7 @@ interface PinoSourceConfig { } /** - * Creates a new Sentry Pino transport that forwards logs to Sentry. Requires `_experiments.enableLogs` to be enabled. + * Creates a new Sentry Pino transport that forwards logs to Sentry. Requires the `enableLogs` option to be enabled. * * Supports Pino v8 and v9. * diff --git a/packages/vercel-edge/src/logs/exports.ts b/packages/vercel-edge/src/logs/exports.ts index ef2614b81f55..c21477e378b3 100644 --- a/packages/vercel-edge/src/logs/exports.ts +++ b/packages/vercel-edge/src/logs/exports.ts @@ -19,7 +19,7 @@ function captureLog( } /** - * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `trace` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }. @@ -48,7 +48,7 @@ export function trace(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `debug` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }. @@ -78,7 +78,7 @@ export function debug(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `info` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }. @@ -108,7 +108,7 @@ export function info(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `warn` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }. @@ -139,7 +139,7 @@ export function warn(message: ParameterizedString, attributes?: Log['attributes' } /** - * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `error` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }. @@ -171,7 +171,7 @@ export function error(message: ParameterizedString, attributes?: Log['attributes } /** - * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled. + * @summary Capture a log with the `fatal` level. Requires the `enableLogs` option to be enabled. * * @param message - The message to log. * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.