|
| 1 | +# Logs Beta Checkbox Implementation |
| 2 | + |
| 3 | +This document summarizes the implementation of a "Logs Beta" checkbox feature for Sentry SDK setup configurations, similar to the existing user feedback integration checkbox. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Added a "Logs Beta" option to the platform setup configuration checkboxes that, when enabled, shows the appropriate logs setup code for each SDK. This was implemented by: |
| 8 | + |
| 9 | +1. Adding the new option to the onboarding component |
| 10 | +2. Creating/updating logs setup configuration for each platform |
| 11 | +3. Updating platform documentation files to include the logs-beta option |
| 12 | + |
| 13 | +## Changes Made |
| 14 | + |
| 15 | +### 1. Core Component Updates |
| 16 | + |
| 17 | +#### `src/components/onboarding/index.tsx` |
| 18 | +- Added `'logs-beta'` to the `OPTION_IDS` array |
| 19 | +- Added logs-beta option details to `optionDetails` object with description: |
| 20 | + > "Send structured logs from your application to Sentry to view, search, and analyze alongside your errors and performance data." |
| 21 | +
|
| 22 | +### 2. Platform Setup Files |
| 23 | + |
| 24 | +#### `platform-includes/logs/setup/go.mdx` (NEW FILE) |
| 25 | +- Created Go logs setup with `EnableLogs: true` configuration |
| 26 | + |
| 27 | +### 3. Platform Documentation Updates |
| 28 | + |
| 29 | +#### Android (`docs/platforms/android/index.mdx`) |
| 30 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 31 | +- Added Android manifest configuration: |
| 32 | + ```xml |
| 33 | + <!-- ___PRODUCT_OPTION_START___ logs-beta --> |
| 34 | + <!-- Enable logs to be sent to Sentry --> |
| 35 | + <meta-data android:name="io.sentry.logs.enabled" android:value="true" /> |
| 36 | + <!-- ___PRODUCT_OPTION_END___ logs-beta --> |
| 37 | + ``` |
| 38 | + |
| 39 | +#### Flutter (`docs/platforms/dart/guides/flutter/index.mdx`) |
| 40 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 41 | +- Added Flutter configuration: |
| 42 | + ```dart |
| 43 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 44 | + // Enable logs to be sent to Sentry |
| 45 | + options.enableLogs = true; |
| 46 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 47 | + ``` |
| 48 | + |
| 49 | +#### PHP (`docs/platforms/php/index.mdx`) |
| 50 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 51 | +- Added PHP configuration: |
| 52 | + ```php |
| 53 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 54 | + // Enable logs to be sent to Sentry |
| 55 | + 'enable_logs' => true, |
| 56 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 57 | + ``` |
| 58 | + |
| 59 | +#### Python (`docs/platforms/python/index.mdx`) |
| 60 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 61 | +- Added Python configuration: |
| 62 | + ```python |
| 63 | + # ___PRODUCT_OPTION_START___ logs-beta |
| 64 | + # Enable logs to be sent to Sentry |
| 65 | + _experiments={ |
| 66 | + "enable_logs": True, |
| 67 | + }, |
| 68 | + # ___PRODUCT_OPTION_END___ logs-beta |
| 69 | + ``` |
| 70 | + |
| 71 | +#### Ruby (`docs/platforms/ruby/common/index.mdx` and `platform-includes/getting-started-config/ruby.mdx`) |
| 72 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 73 | +- Added Ruby configuration: |
| 74 | + ```ruby |
| 75 | + # ___PRODUCT_OPTION_START___ logs-beta |
| 76 | + # enable logs |
| 77 | + config.enable_logs = true |
| 78 | + # ___PRODUCT_OPTION_END___ logs-beta |
| 79 | + ``` |
| 80 | + |
| 81 | +#### Go (`docs/platforms/go/guides/gin/index.mdx`) |
| 82 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 83 | +- Added Go configuration: |
| 84 | + ```go |
| 85 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 86 | + // Enable logs to be sent to Sentry |
| 87 | + EnableLogs: true, |
| 88 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 89 | + ``` |
| 90 | + |
| 91 | +#### Java (`platform-includes/getting-started-config/java.mdx`) |
| 92 | +- Added Java configuration for both Java and Kotlin: |
| 93 | + ```java |
| 94 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 95 | + // Enable logs to be sent to Sentry |
| 96 | + options.getLogs().setEnabled(true); |
| 97 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 98 | + ``` |
| 99 | + ```kotlin |
| 100 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 101 | + // Enable logs to be sent to Sentry |
| 102 | + options.logs.enabled = true |
| 103 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 104 | + ``` |
| 105 | + |
| 106 | +#### JavaScript (`docs/platforms/javascript/guides/react/index.mdx` and `platform-includes/getting-started-config/javascript.mdx`) |
| 107 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 108 | +- Added JavaScript configuration: |
| 109 | + ```javascript |
| 110 | + // ___PRODUCT_OPTION_START___ logs-beta |
| 111 | + // Enable logs to be sent to Sentry |
| 112 | + _experiments: { enableLogs: true }, |
| 113 | + // ___PRODUCT_OPTION_END___ logs-beta |
| 114 | + ``` |
| 115 | + |
| 116 | +#### Next.js (`docs/platforms/javascript/guides/nextjs/manual-setup.mdx`) |
| 117 | +- Added `'logs-beta'` to OnboardingOptionButtons options |
| 118 | + |
| 119 | +## Implementation Details |
| 120 | + |
| 121 | +### SDK-Specific Configuration Methods |
| 122 | + |
| 123 | +Each SDK uses its own method to enable logs: |
| 124 | + |
| 125 | +- **Java/Android**: `options.getLogs().setEnabled(true)` or `options.logs.enabled = true` |
| 126 | +- **JavaScript**: `_experiments: { enableLogs: true }` |
| 127 | +- **Python**: `_experiments={"enable_logs": True}` |
| 128 | +- **Ruby**: `config.enable_logs = true` |
| 129 | +- **PHP**: `'enable_logs' => true` |
| 130 | +- **Go**: `EnableLogs: true` |
| 131 | +- **Flutter**: `options.enableLogs = true` |
| 132 | + |
| 133 | +### Product Option Markers |
| 134 | + |
| 135 | +All configurations use the standard product option markers: |
| 136 | +``` |
| 137 | +// ___PRODUCT_OPTION_START___ logs-beta |
| 138 | +[configuration code] |
| 139 | +// ___PRODUCT_OPTION_END___ logs-beta |
| 140 | +``` |
| 141 | + |
| 142 | +These markers are automatically processed by the onboarding component to show/hide the configuration based on checkbox selection. |
| 143 | + |
| 144 | +## Coverage |
| 145 | + |
| 146 | +The implementation covers all requested SDKs: |
| 147 | +- ✅ Java |
| 148 | +- ✅ Android |
| 149 | +- ✅ Flutter |
| 150 | +- ✅ PHP |
| 151 | +- ✅ Python |
| 152 | +- ✅ Ruby |
| 153 | +- ✅ Go |
| 154 | +- ✅ JavaScript (React, Next.js, and common config) |
| 155 | + |
| 156 | +## Testing |
| 157 | + |
| 158 | +Users can now: |
| 159 | +1. Visit any supported platform documentation page |
| 160 | +2. See the "Logs Beta" checkbox in the feature selection |
| 161 | +3. Check the box to see logs setup configuration appear |
| 162 | +4. Copy the configuration to enable logs in their application |
| 163 | + |
| 164 | +The implementation follows the same pattern as existing features like user feedback, ensuring consistency across the documentation. |
0 commit comments