Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skills/sentry-react-native-sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ Sentry.init({
| Option | Type | Purpose |
|--------|------|---------|
| `enableLogs` | `boolean` | Enable `Sentry.logger.*` API |
| `enableAutoConsoleLogs` | `boolean` | Auto-capture `console.*` calls when `enableLogs: true`. Set `false` to use only manual `Sentry.logger.*` (SDK ≥8.14.0, default: `true`) |
| `beforeSendLog` | `function` | Filter/modify logs before sending |
| `logsOrigin` | `'native' \| 'js' \| 'all'` | Filter log source (SDK ≥7.7.0) |

Expand Down
9 changes: 8 additions & 1 deletion skills/sentry-react-native-sdk/references/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,16 @@ Sentry.withScope(async (scope) => {

Automatically forwards `console.log`, `console.warn`, and `console.error` calls to Sentry as structured logs. Requires SDK ≥7.0.0.

**SDK ≥8.14.0:** Console capture is enabled by default when `enableLogs: true`. Set `enableAutoConsoleLogs: false` to disable automatic console capture and use only manual `Sentry.logger.*` calls.

```typescript
Sentry.init({
dsn: "YOUR_DSN",
enableLogs: true,
// SDK ≥8.14.0: console capture is automatic. To disable:
// enableAutoConsoleLogs: false,

// SDK <8.14.0: add consoleLoggingIntegration manually:
integrations: [
Sentry.consoleLoggingIntegration({
levels: ["log", "warn", "error"], // default — adjust as needed
Comment on lines +165 to 171
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The documentation in logging.md contains an outdated code example and troubleshooting advice that will cause duplicate console log capture for users on SDK ≥8.14.0.
Severity: MEDIUM

Suggested Fix

Comment out the consoleLoggingIntegration() code block in the example, as it's only for SDKs <8.14.0. Update the troubleshooting table to advise checking enableLogs: true and ensuring enableAutoConsoleLogs is not false for newer SDKs, instead of adding the manual integration.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: skills/sentry-react-native-sdk/references/logging.md#L165-L171

Potential issue: The documentation in `logging.md` contains an outdated code example and
troubleshooting advice. For SDK versions 8.14.0 and newer, console logging is enabled by
default via `enableAutoConsoleLogs`. However, a code example for manual setup with
`consoleLoggingIntegration()` is still active, and a troubleshooting entry incorrectly
advises adding this manual integration. Users on newer SDKs who follow either the
example or the troubleshooting advice will have both automatic and manual integrations
running, resulting in duplicate capture for every console log.

Also affects:

  • skills/sentry-react-native-sdk/references/logging.md:156~164

Did we get this right? 👍 / 👎 to inform future reviews.

Expand All @@ -176,7 +182,7 @@ console.warn("Memory pressure detected", memoryUsage);
console.error("Fetch failed:", error.message);
```

> **React Native note:** All `console.*` calls in React Native go through the JS bridge. In development, the `consoleLoggingIntegration` will forward them all — use `beforeSendLog` to filter out noise before it reaches Sentry.
> **React Native note:** All `console.*` calls in React Native go through the JS bridge. In development, the console capture will forward them all — use `beforeSendLog` to filter out noise before it reaches Sentry.

---

Expand Down Expand Up @@ -378,6 +384,7 @@ function checkoutMiddleware(store) {
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enableLogs` | `boolean` | `false` | Master switch — must be `true` for all logging features |
| `enableAutoConsoleLogs` | `boolean` | `true` | When `enableLogs: true`, automatically capture `console.*` calls. Set `false` to disable auto-capture and use only manual `Sentry.logger.*` (SDK ≥8.14.0) |
| `beforeSendLog` | `(log) => log \| null` | `undefined` | Filter/mutate logs before transmission |
| `consoleLoggingIntegration` | integration | not added | Capture `console.*` calls as structured logs |

Expand Down