Skip to content

feat(core)!: Enable logs by default - #22630

Merged
nicohrubec merged 6 commits into
developfrom
feat/enable-logs-by-default
Jul 29, 2026
Merged

feat(core)!: Enable logs by default#22630
nicohrubec merged 6 commits into
developfrom
feat/enable-logs-by-default

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Jul 24, 2026

Copy link
Copy Markdown
Member

This flips the enableLogs client option to default to true so users get Sentry Logs without opting in manually, matching how enableMetrics already behaves. Nothing is captured unless the Sentry.logger API is called or a logging integration is explicitly enabled, and an explicit enableLogs: false still turns it off.

Fixes #20639

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ce5221b. Configure here.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.84 kB +0.01% +2 B 🔺
@sentry/browser - with treeshaking flags 28.05 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing) 47.12 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.13 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.83 kB +0.01% +3 B 🔺
@sentry/browser (incl. Tracing, Replay) 86.43 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.86 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 91.15 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.79 kB +0.01% +1 B 🔺
@sentry/browser (incl. Feedback) 47.16 kB +0.01% +1 B 🔺
@sentry/browser (incl. sendFeedback) 34.68 kB +0.01% +2 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.78 kB +0.01% +2 B 🔺
@sentry/browser (incl. Metrics) 30.91 kB +0.01% +2 B 🔺
@sentry/browser (incl. Logs) 31.14 kB +0.01% +2 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.82 kB +0.01% +1 B 🔺
@sentry/react 31.63 kB +0.01% +2 B 🔺
@sentry/react (incl. Tracing) 49.35 kB +0.01% +2 B 🔺
@sentry/vue 34.76 kB +0.01% +2 B 🔺
@sentry/vue (incl. Tracing) 49.08 kB +0.01% +3 B 🔺
@sentry/svelte 29.87 kB +0.01% +2 B 🔺
CDN Bundle 31.89 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing) 47.47 kB +0.01% +3 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.44 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 48.84 kB +0.01% +1 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 72.8 kB +0.01% +3 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.11 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 90.88 kB +0.01% +3 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.19 kB +0.01% +1 B 🔺
CDN Bundle - uncompressed 95.11 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 142.33 kB +0.01% +4 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.83 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 146.31 kB +0.01% +4 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.58 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 261.59 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 265.55 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 275.29 kB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 279.25 kB +0.01% +4 B 🔺
@sentry/nextjs (client) 51.95 kB +0.01% +3 B 🔺
@sentry/sveltekit (client) 47.54 kB +0.01% +2 B 🔺
@sentry/core/server 79.78 kB +0.01% +2 B 🔺
@sentry/core/browser 51.61 kB +0.01% +2 B 🔺
@sentry/node 121.06 kB +0.01% +2 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 84.48 kB +0.01% +2 B 🔺
@sentry/aws-serverless 92.71 kB +0.01% +3 B 🔺
@sentry/cloudflare (withSentry) - minified 197.81 kB +0.01% +4 B 🔺
@sentry/cloudflare (withSentry) 486.2 kB +0.01% +8 B 🔺

View base workflow run

@nicohrubec
nicohrubec force-pushed the feat/enable-logs-by-default branch from 5a51b06 to 721edd9 Compare July 24, 2026 14:08
@nicohrubec
nicohrubec marked this pull request as ready for review July 24, 2026 14:47
@nicohrubec
nicohrubec requested review from a team as code owners July 24, 2026 14:47
@nicohrubec
nicohrubec requested review from JPeer264 and isaacs and removed request for a team July 24, 2026 14:47

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there are still some comments and markdown docs that have this feature (excluding the v9-v10 migration docs ofc)

Screenshot 2026-07-28 at 08 44 43

nicohrubec and others added 5 commits July 29, 2026 09:57
Flip the `enableLogs` client option to default to `true`, mirroring `enableMetrics`.
No logs are emitted unless the logger API is called or a logging integration is
explicitly enabled, since no default integration captures logs.

Fixes #20639

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The client constructor backfills `enableLogs` onto its options, so the strict
`getOptions()` equality check now needs the resolved default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Flush the log buffer before capturing the sentinel error so a leaked log
envelope arrives first and fails the ordered `event` expectation. Previously
the error was sent first and the runner could complete before a stray log
arrived, letting a broken disable path pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The constructor already backfills `enableLogs` from `_experiments.enableLogs`,
so re-reading `_experiments` in the capture guard was dead code. Reduce it to a
plain destructure default, matching the original shape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The default has now been flipped, so the "or change default value" branch of the
TODO is done. Narrow it to removing the deprecated experimental flag, matching
the adjacent enableMetrics TODO.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubec force-pushed the feat/enable-logs-by-default branch from 10618d3 to e5f2c76 Compare July 29, 2026 08:16
@nicohrubec
nicohrubec requested review from a team as code owners July 29, 2026 08:16
@nicohrubec
nicohrubec requested review from chargome, logaretm, msonnb and s1gr1d and removed request for a team, chargome, logaretm, msonnb and s1gr1d July 29, 2026 08:16
Logs default to `true` now, so the JSDoc note that the logger API and logging
integrations require `enableLogs` to be enabled is no longer accurate. Drop the
clause, the redundant `enableLogs: true` from init examples/READMEs, and the
`_experiments.enableLogs` flag from the shared browser logger test init.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubec force-pushed the feat/enable-logs-by-default branch from e5f2c76 to 8a28f39 Compare July 29, 2026 08:22
@nicohrubec

Copy link
Copy Markdown
Member Author

@JPeer264 made another pass to remove some more references, there is still a few left which are needed for specific tests

@nicohrubec
nicohrubec requested a review from JPeer264 July 29, 2026 08:24

@chargome chargome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I did a quick scan and I think none of the integrations are enabled by default 👍
Keep in mind we also need to change the default in the loader script once this is released.

@nicohrubec

Copy link
Copy Markdown
Member Author

@chargome thanks for the reminder, added a ticket for this on linear to our v11 follow up tasks

@nicohrubec
nicohrubec merged commit c7600d9 into develop Jul 29, 2026
527 of 529 checks passed
@nicohrubec
nicohrubec deleted the feat/enable-logs-by-default branch July 29, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable logging by default [Javascript]

4 participants