File tree Expand file tree Collapse file tree 4 files changed +36
-9
lines changed
platform-includes/getting-started-include-logs-config Expand file tree Collapse file tree 4 files changed +36
-9
lines changed Original file line number Diff line number Diff 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+
1820To 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments