-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(go): add logs page #13684
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
feat(go): add logs page #13684
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
Bundle ReportChanges will increase total bundle size by 147 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
view changes for bundle: sentry-docs-client-array-pushAssets Changed:
|
| The `Sentry.Logger` API exposes methods that support six different log levels: `trace`, | ||
| `debug`, `info`, `warn`, `error` and `fatal`. The methods support both `fmt.Print` and `fmt.Println` like syntax. Using | ||
| these methods is as simple as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `Sentry.Logger` API exposes methods that support six different log levels: `trace`, | |
| `debug`, `info`, `warn`, `error` and `fatal`. The methods support both `fmt.Print` and `fmt.Println` like syntax. Using | |
| these methods is as simple as: | |
| The `Sentry.Logger` API exposes methods that support six different log levels: `trace`, | |
| `debug`, `info`, `warn`, `error` and `fatal`. The methods support both `fmt.Print` and `fmt.Printf` like syntax. | |
| If you pass in format specifiers like `%v`, these will be sent to Sentry, and can be searched from within the Logs UI, and even added to the Logs views as a dedicated column. |
| Additionally, you can attach properties to each log entry using the `attribute` API. These properties will be sent | ||
| to Sentry, and can be searched from within the Logs UI, and even added to the Logs views as a dedicated column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Additionally, you can attach properties to each log entry using the `attribute` API. These properties will be sent | |
| to Sentry, and can be searched from within the Logs UI, and even added to the Logs views as a dedicated column. | |
| You can also pass additional attributes to the logger via the `SetAttributes` function. These attributes will also be searchable in the Logs UI. |
| However in order to properly attach the correct Spans with each Log entry, a `context.Context` is required. The `Write` function of | ||
| the `io.Writer` interface does not provide `context` so currently wrapping the custom logger will provide limited functionality. | ||
| The recommended way is to use the `sentry.Logger` itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| However in order to properly attach the correct Spans with each Log entry, a `context.Context` is required. The `Write` function of | |
| the `io.Writer` interface does not provide `context` so currently wrapping the custom logger will provide limited functionality. | |
| The recommended way is to use the `sentry.Logger` itself. | |
| In order to properly attach the correct trace with each Log entry, a `context.Context` is required. The `Write` function of | |
| the `io.Writer` interface does not provide `context` so wrapping the custom logger will not get the trace and current span attached. | |
| We recommend using the `sentry.Logger` to ensure your logs are connected to spans and errors in the Sentry UI. |
|
|
||
| ### Debug | ||
|
|
||
| If debug is set to true, calls to the logger will also print to the console with the appropriate log level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If debug is set to true, calls to the logger will also print to the console with the appropriate log level. | |
| If the `Debug` init option is set to true, calls to the `sentry.Logger` APIs will also print to the console with the appropriate log level. |
| @@ -0,0 +1,143 @@ | |||
| --- | |||
| title: Set Up Logs | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| title: Set Up Logs | |
| title: Set Up Logs in Go |
| --- | ||
| title: Set Up Logs | ||
| sidebar_title: Logs | ||
| description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." | |
| description: "Structured logs allow you to send, view, and query logs sent from your applications within Sentry." |
| logger.Warnf(ctx, "I have params: %v and attributes", "example param") | ||
| } | ||
| ``` | ||
| Currently the `attribute` API supports only these value types: `int`, `string`, `bool` and `float`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Currently the `attribute` API supports only these value types: `int`, `string`, `bool` and `float`. | |
| Currently the `attribute` API supports only these value types: `int`, `string`, `bool`, and `float`. |
|
|
||
| <Alert> | ||
| In order to properly attach the correct trace with each Log entry, a `context.Context` is required. The `Write` function of | ||
| the `io.Writer` interface does not provide `context` so wrapping the custom logger will not get the trace and current span attached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| the `io.Writer` interface does not provide `context` so wrapping the custom logger will not get the trace and current span attached. | |
| the `io.Writer` interface doesn't provide `context`, so wrapping the custom logger will not get the trace and current span attached. |
coolguyzone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for adding 🕺
AbhiPrasad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update https://github.com/getsentry/sentry-docs/blob/master/docs/product/explore/logs/getting-started/index.mdx as well here!
DESCRIBE YOUR PR
adding initial logs page for the Go SDK.
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.