Skip to content

Commit d19bcfa

Browse files
committed
create platform includes snippet for logs config
1 parent 0cb3f24 commit d19bcfa

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed

docs/platforms/go/common/logs/index.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ Logs in Go are supported in Sentry Go SDK version `0.33.0` and above. To use int
1515

1616
## Configure
1717

18+
### Initialize the Sentry SDK
19+
1820
To enable logging, you need to initialize the SDK with the `EnableLogs` option set to true.
1921

20-
```go
21-
sentry.Init(sentry.ClientOptions{
22-
Dsn: "___PUBLIC_DSN___",
23-
// Enable logs to be sent to Sentry
24-
EnableLogs: true,
25-
})
26-
```
22+
<PlatformContent includePath="getting-started-include-logs-config" />
2723

2824
### Options
2925

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ go get github.com/getsentry/sentry-go/logrus
2222

2323
### Initialize the Sentry SDK
2424

25-
<PlatformContent includePath="getting-started-config" />
25+
<PlatformContent includePath="getting-started-include-logs-config" />
2626

2727
### Options
2828

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ go get github.com/getsentry/sentry-go/slog
2222

2323
### Initialize the Sentry SDK
2424

25-
<PlatformContent includePath="getting-started-config" />
25+
<PlatformContent includePath="getting-started-include-logs-config" />
2626

2727
### Options
2828

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<OnboardingOptionButtons
2+
options={[
3+
'error-monitoring',
4+
'performance',
5+
]}
6+
/>
7+
8+
```go
9+
err := sentry.Init(sentry.ClientOptions{
10+
Dsn: "___PUBLIC_DSN___",
11+
// Enable printing of SDK debug messages.
12+
// Useful when getting started or trying to figure something out.
13+
Debug: true,
14+
// Adds request headers and IP for users,
15+
// visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info
16+
SendDefaultPII: true,
17+
EnableLogs: true,
18+
// ___PRODUCT_OPTION_START___ performance
19+
EnableTracing: true,
20+
// Set TracesSampleRate to 1.0 to capture 100%
21+
// of transactions for tracing.
22+
TracesSampleRate: 1.0,
23+
// ___PRODUCT_OPTION_END___ performance
24+
})
25+
if err != nil {
26+
log.Fatalf("sentry.Init: %s", err)
27+
}
28+
// Flush buffered events before the program terminates.
29+
// Set the timeout to the maximum duration the program can afford to wait.
30+
defer sentry.Flush(2 * time.Second)
31+
```

0 commit comments

Comments
 (0)