Skip to content

Commit a510dcf

Browse files
committed
Add logs beta option to SDK onboarding across multiple platforms
1 parent 509080c commit a510dcf

File tree

14 files changed

+263
-5
lines changed

14 files changed

+263
-5
lines changed

LOGS_BETA_IMPLEMENTATION.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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.

docs/platforms/android/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3131
'error-monitoring',
3232
'performance',
3333
'profiling',
34-
'session-replay'
34+
'session-replay',
35+
'logs-beta'
3536
]}
3637
/>
3738

@@ -133,6 +134,10 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
133134
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
134135
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="0.1" />
135136
<!-- ___PRODUCT_OPTION_END___ session-replay -->
137+
<!-- ___PRODUCT_OPTION_START___ logs-beta -->
138+
<!-- Enable logs to be sent to Sentry -->
139+
<meta-data android:name="io.sentry.logs.enabled" android:value="true" />
140+
<!-- ___PRODUCT_OPTION_END___ logs-beta -->
136141
</application>
137142
```
138143

docs/platforms/dart/guides/flutter/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3232
'error-monitoring',
3333
'performance',
3434
'profiling',
35+
'logs-beta',
3536
]}
3637
/>
3738

@@ -83,6 +84,10 @@ Future<void> main() async {
8384
// Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
8485
options.profilesSampleRate = 1.0;
8586
// ___PRODUCT_OPTION_END___ profiling
87+
// ___PRODUCT_OPTION_START___ logs-beta
88+
// Enable logs to be sent to Sentry
89+
options.enableLogs = true;
90+
// ___PRODUCT_OPTION_END___ logs-beta
8691
},
8792
appRunner: () => runApp(
8893
SentryWidget(

docs/platforms/go/guides/gin/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
1919
options={[
2020
'error-monitoring',
2121
'performance',
22+
'logs-beta',
2223
]}
2324
/>
2425

@@ -49,6 +50,10 @@ if err := sentry.Init(sentry.ClientOptions{
4950
// We recommend adjusting this value in production,
5051
TracesSampleRate: 1.0,
5152
// ___PRODUCT_OPTION_END___ performance
53+
// ___PRODUCT_OPTION_START___ logs-beta
54+
// Enable logs to be sent to Sentry
55+
EnableLogs: true,
56+
// ___PRODUCT_OPTION_END___ logs-beta
5257
// Adds request headers and IP for users,
5358
// visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info
5459
SendDefaultPII: true,

docs/platforms/javascript/guides/nextjs/manual-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: "Learn how to manually set up Sentry in your Next.js app and captur
1616
Choose the features you want to configure, and this guide will show you how:
1717

1818
<OnboardingOptionButtons
19-
options={["error-monitoring", "performance", "session-replay", "user-feedback"]}
19+
options={["error-monitoring", "performance", "profiling", "session-replay", "user-feedback", "logs-beta"]}
2020
/>
2121

2222
<PlatformContent includePath="getting-started-features-expandable" />

docs/platforms/javascript/guides/react/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ categories:
1616
Choose the features you want to configure, and this guide will show you how:
1717

1818
<OnboardingOptionButtons
19-
options={["error-monitoring", "performance", "session-replay", "user-feedback"]}
19+
options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs-beta"]}
2020
/>
2121

2222
<PlatformContent includePath="getting-started-features-expandable" />
@@ -71,6 +71,11 @@ Sentry.init({
7171
// ___PRODUCT_OPTION_END___ user-feedback
7272
],
7373

74+
// ___PRODUCT_OPTION_START___ logs-beta
75+
// Enable logs to be sent to Sentry
76+
_experiments: { enableLogs: true },
77+
// ___PRODUCT_OPTION_END___ logs-beta
78+
7479
// ___PRODUCT_OPTION_START___ performance
7580
// Set tracesSampleRate to 1.0 to capture 100%
7681
// of transactions for tracing.

docs/platforms/php/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ categories:
1818

1919
<p className="mb-5">Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.</p>
2020

21-
<OnboardingOptionButtons options={['error-monitoring', 'performance', 'profiling']}/>
21+
<OnboardingOptionButtons options={['error-monitoring', 'performance', 'profiling', 'logs-beta']}/>
2222

2323
## Install
2424

@@ -59,6 +59,10 @@ To capture all errors, even the one during the startup of your application, you
5959
// Set a sampling rate for profiling - this is relative to traces_sample_rate
6060
'profiles_sample_rate' => 1.0,
6161
// ___PRODUCT_OPTION_END___ profiling
62+
// ___PRODUCT_OPTION_START___ logs-beta
63+
// Enable logs to be sent to Sentry
64+
'enable_logs' => true,
65+
// ___PRODUCT_OPTION_END___ logs-beta
6266
]);
6367
```
6468

@@ -83,3 +87,4 @@ try {
8387
If you're using Laravel's Forge platform to provision and deploy your PHP application, you can create a Sentry organization through [Forge](https://forge.laravel.com/docs/integrations/sentry.html).
8488

8589
![Sentry and Forge](./img/forge-sentry.png)
90+

docs/platforms/python/index.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ categories:
2424
'error-monitoring',
2525
'performance',
2626
'profiling',
27+
'logs-beta',
2728
]}
2829
/>
2930

@@ -65,6 +66,12 @@ sentry_sdk.init(
6566
# there is an active span.
6667
profile_lifecycle="trace",
6768
# ___PRODUCT_OPTION_END___ profiling
69+
# ___PRODUCT_OPTION_START___ logs-beta
70+
# Enable logs to be sent to Sentry
71+
_experiments={
72+
"enable_logs": True,
73+
},
74+
# ___PRODUCT_OPTION_END___ logs-beta
6875
)
6976
```
7077

docs/platforms/ruby/common/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In addition to capturing errors, you can monitor interactions between multiple s
1212
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
1313

1414
<OnboardingOptionButtons
15-
options={["error-monitoring", "performance", "profiling"]}
15+
options={["error-monitoring", "performance", "profiling", "logs-beta"]}
1616
/>
1717

1818
## Install

platform-includes/getting-started-config/java.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Sentry.init(options -> {
1717
// We recommend adjusting this value in production.
1818
options.setTracesSampleRate(1.0);
1919
// ___PRODUCT_OPTION_END___ performance
20+
// ___PRODUCT_OPTION_START___ logs-beta
21+
22+
// Enable logs to be sent to Sentry
23+
options.getLogs().setEnabled(true);
24+
// ___PRODUCT_OPTION_END___ logs-beta
2025
});
2126
```
2227

@@ -36,6 +41,11 @@ Sentry.init { options ->
3641
// We recommend adjusting this value in production.
3742
options.tracesSampleRate = 1.0
3843
// ___PRODUCT_OPTION_END___ performance
44+
// ___PRODUCT_OPTION_START___ logs-beta
45+
46+
// Enable logs to be sent to Sentry
47+
options.logs.enabled = true
48+
// ___PRODUCT_OPTION_END___ logs-beta
3949
}
4050
```
4151
</OnboardingOption>

0 commit comments

Comments
 (0)