Skip to content

feat(go): Modify docs to follow logger API changes #14260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

giortzisg
Copy link
Collaborator

@giortzisg giortzisg commented Jul 4, 2025

DESCRIBE YOUR PR

Changing the docs to adhere with the logging API signature changes in Go.

@giortzisg giortzisg requested a review from cleptric July 4, 2025 09:52
@giortzisg giortzisg self-assigned this Jul 4, 2025
Copy link

vercel bot commented Jul 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2025 0:19am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
develop-docs ⬜️ Ignored (Inspect) Visit Preview Jul 8, 2025 0:19am

Copy link

codecov bot commented Jul 4, 2025

Bundle Report

Changes will increase total bundle size by 9.27kB (0.04%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 11.81MB 9.28kB (0.08%) ⬆️
sentry-docs-client-array-push 9.8MB -6 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 873.24kB -0.0%
static/chunks/7750-*.js -3 bytes 415.85kB -0.0%
static/A-*.js (New) 77 bytes 77 bytes 100.0% 🚀
static/A-*.js (New) 684 bytes 684 bytes 100.0% 🚀
static/YuCC3bmRI2Wt72ROPriwx/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/YuCC3bmRI2Wt72ROPriwx/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.64MB -0.0%
../instrumentation.js -3 bytes 973.36kB -0.0%
9523.js -3 bytes 949.31kB -0.0%
../app/[[...path]]/page.js.nft.json 3.1kB 695.71kB 0.45%
../app/platform-redirect/page.js.nft.json 3.1kB 695.62kB 0.45%
../app/sitemap.xml/route.js.nft.json 3.1kB 693.59kB 0.45%

@@ -11,149 +11,128 @@ With Sentry Structured Logs, you can send text based log information from your a

## Requirements

Logs in Go are supported in Sentry Go SDK version `0.33.0` and above.
Logs in Go are supported in Sentry Go SDK version `0.33.0` and above. For using integrations of other log libraries, have a look at each specific page for more details on requirements.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Logs in Go are supported in Sentry Go SDK version `0.33.0` and above. For using integrations of other log libraries, have a look at each specific page for more details on requirements.
Logs in Go are supported in Sentry Go SDK version `0.33.0` and above. To use integrations with other logging libraries, check their specific documentation pages for detailed requirements.

@@ -0,0 +1,4 @@
## Correlating Logs with Traces
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Correlating Logs with Traces
## Correlating Logs With Traces

## Correlating Logs with Traces

In order to properly attach the correct trace with each log entry, a `context.Context` is required.
If you're using logs combined with tracing, you should pass the correct context to properly attach each trace with the appropriate logs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you're using logs combined with tracing, you should pass the correct context to properly attach each trace with the appropriate logs.
When using logs with tracing, make sure to pass the correct context so each log is properly associated with its trace.

### LogHook

Use `sentrylogrus.NewLogHook()` to send structured logs to Sentry. This hook captures log entries and sends them to Sentry's structured logging system.
You have two ways to create a new `LogHook`. Either by using `sentrylogrus.NewLogHook()` and passing the `sentry.ClientOptions` or
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You have two ways to create a new `LogHook`. Either by using `sentrylogrus.NewLogHook()` and passing the `sentry.ClientOptions` or
You have two ways to create a new `LogHook`. Either by using `sentrylogrus.NewLogHook()` and passing the `sentry.ClientOptions`, or

```

### EventHook

Use `sentrylogrus.NewEventHook()` to send log entries as Sentry events. This is useful for error tracking and alerting.
You also have two ways to create a new `EventHook`. Either by using `sentrylogrus.NewEventHook()` and passing the `sentry.ClientOptions` or
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You also have two ways to create a new `EventHook`. Either by using `sentrylogrus.NewEventHook()` and passing the `sentry.ClientOptions` or
You also have two ways to create a new `EventHook`. Either use `sentrylogrus.NewEventHook()` and passing the `sentry.ClientOptions`, or

"github.com/getsentry/sentry-go"
sentryslog "github.com/getsentry/sentry-go/slog"
)
To integrate Sentry with slog, you need to set up a Sentry handler and configure the Sentry client.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To integrate Sentry with slog, you need to set up a Sentry handler and configure the Sentry client.
To integrate Sentry with slog, you need to set up a Sentry handler and configure the Sentry client:

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

LGTM!

@giortzisg
Copy link
Collaborator Author

This has some overlap with #14276, so removed the logrus and slog changes to make it easier to review. This PR is limited to only the changes of the sentryLogger API for Go here.

@giortzisg giortzisg changed the title feat(go): Restructure log docs feat(go): Modify docs to follow logger API changes Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants