Skip to content

feat(logs): Enable logs by default#3846

Open
buenaflor wants to merge 1 commit into
v10-branchfrom
ref/integration-log-opt-in
Open

feat(logs): Enable logs by default#3846
buenaflor wants to merge 1 commit into
v10-branchfrom
ref/integration-log-opt-in

Conversation

@buenaflor

Copy link
Copy Markdown
Contributor

SentryOptions.enableLogs now defaults to true, matching enableMetrics, so calling Sentry.logger.* works without any configuration.

Flipping the default sends nothing by itself: logs only flow when the user emits them — by calling Sentry.logger.* or by explicitly adding a log-emitting integration. Per the develop spec, integrations that auto-emit logs must be opt-in; the audit for #3833 confirmed LoggingIntegration (sentry_logging) is the only such integration in this repo and is never auto-registered, so explicitly adding it is the opt-in and no integration-level toggle is needed. Doc comments on enableLogs and LoggingIntegration now spell out that contract.

Behavior change for existing users: apps that already add LoggingIntegration (or call Sentry.logger.*) without setting enableLogs = true will start sending logs after upgrading; setting enableLogs = false restores the old behavior.

Fixes #3682
Fixes #3833

Flip SentryOptions.enableLogs default from false to true so logs work
out of the box, matching enableMetrics. Logs are only sent when the
user emits them - by calling Sentry.logger.* or by explicitly adding a
log-emitting integration (LoggingIntegration is the only one and is
never auto-registered), so the flip alone sends nothing.

Document the opt-in contract on enableLogs and LoggingIntegration, pin
the new default with a test, and opt metrics-focused lifecycle tests
out of logs explicitly.

Fixes GH-3682
Fixes GH-3833
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Features

  • (grpc) Add integration support for GRPC by lucas-zimerman in #3721
  • (logs) Enable logs by default by buenaflor in #3846

Fixes

  • Correct feature flag scope buffer updates by denrase in #3797

Dependencies

Deps

  • chore(deps): update Android SDK to v8.46.0 by github-actions in #3793
  • chore(deps): update Native SDK to v0.15.2 by github-actions in #3785

Internal Changes

  • (skills) Expand test-guidelines and drop stale deps by buenaflor in #3807
  • Add PR template checkbox for cross sdk review on public API changes by antonis in #3822
  • Block manual CHANGELOG.md edits by buenaflor in #3810
  • Fix Dependabot pub paths and pin GitHub Action by buenaflor in #3804
  • Add AI Use section to CONTRIBUTING.md by christophaigner in #3803

🤖 This preview updates automatically when you update the PR.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v10-branch@59d7c7b). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@              Coverage Diff              @@
##             v10-branch    #3846   +/-   ##
=============================================
  Coverage              ?   87.30%           
=============================================
  Files                 ?      337           
  Lines                 ?    12257           
  Branches              ?        0           
=============================================
  Hits                  ?    10701           
  Misses                ?     1556           
  Partials              ?        0           
Flag Coverage Δ
sentry 87.25% <ø> (?)
sentry_dio 97.73% <ø> (?)
sentry_drift 93.57% <ø> (?)
sentry_file 65.29% <ø> (?)
sentry_firebase_remote_config 100.00% <ø> (?)
sentry_flutter 91.33% <ø> (?)
sentry_grpc 99.09% <ø> (?)
sentry_hive 77.48% <ø> (?)
sentry_isar 74.37% <ø> (?)
sentry_link 21.50% <ø> (?)
sentry_logging 97.01% <ø> (?)
sentry_sqflite 88.81% <ø> (?)
sentry_supabase 97.27% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@buenaflor buenaflor marked this pull request as ready for review July 1, 2026 21:37
@buenaflor buenaflor requested a review from denrase as a code owner July 1, 2026 21:37
Copilot AI review requested due to automatic review settings July 1, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the core SDK default so SentryOptions.enableLogs is true by default (aligning with enableMetrics), allowing Sentry.logger.* to function without additional configuration while still only sending logs when they are explicitly emitted (via Sentry.logger.*) or via an explicitly added log-emitting integration (e.g. LoggingIntegration from sentry_logging).

Changes:

  • Flip SentryOptions.enableLogs default from false to true and update its doc comment to clarify the opt-in model.
  • Clarify LoggingIntegration docs to state that adding the integration is the opt-in for forwarding package:logging records as structured Sentry logs (still gated by enableLogs).
  • Add/adjust tests to reflect the new default and keep unrelated integration tests deterministic.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/dart/lib/src/sentry_options.dart Sets enableLogs default to true and documents when logs are sent.
packages/dart/test/sentry_options_test.dart Adds coverage asserting enableLogs is true by default.
packages/logging/lib/src/logging_integration.dart Updates docs to clarify opt-in behavior and the enableLogs gating.
packages/flutter/test/integrations/load_contexts_integration_test.dart Explicitly disables logs in metrics-focused tests to avoid log-related lifecycle callback registration affecting expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants