You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/go/common/logs/index.mdx
+73-94Lines changed: 73 additions & 94 deletions
Original file line number
Diff line number
Diff line change
@@ -11,149 +11,128 @@ With Sentry Structured Logs, you can send text based log information from your a
11
11
12
12
## Requirements
13
13
14
-
Logs in Go are supported in Sentry Go SDK version `0.33.0` and above.
14
+
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.
15
15
16
16
## Setup
17
17
18
18
To enable logging, you need to initialize the SDK with the `EnableLogs` option set to true.
In order to properly attach the correct trace with each Log entry, a
116
-
`context.Context` is required. The `Write` function of the `io.Writer`
117
-
interface doesn't provide `context`, so wrapping the custom logger will not
118
-
get the trace and current span attached. We recommend using the
119
-
`sentry.Logger` to ensure your logs are connected to spans and errors in the
120
-
Sentry UI.
121
-
</Alert>
122
-
123
-
### Integrations
124
-
-[Slog](/platforms/go/guides/slog)
125
-
-[Logrus](/platforms/go/guides/logrus)
126
-
127
-
### Upcoming Integrations
128
-
129
-
We're actively working on adding more integration support for Logs. Currently, we are looking at adding support for [`zerolog`](https://pkg.go.dev/github.com/rs/zerolog). You can follow this [GitHub issue](https://github.com/getsentry/sentry-go/issues/1015) to track progress.
130
-
131
109
## Options
132
110
133
111
### BeforeSendLog
134
112
135
113
To filter logs, or update them before they are sent to Sentry, you can use the `BeforeSendLog` client option.
`sentrylogrus` provides two types of hooks to configure the integration with Sentry. Both hooks accept these options:
117
-
-**Levels**: A slice of `logrus.Level` specifying which log levels to capture
118
-
-**ClientOptions**: Standard `sentry.ClientOptions` for configuration
119
-
120
118
### LogHook
121
119
122
-
Use `sentrylogrus.NewLogHook()` to send structured logs to Sentry. This hook captures log entries and sends them to Sentry's structured logging system.
120
+
You have two ways to create a new `LogHook`. Either by using `sentrylogrus.NewLogHook()` and passing the `sentry.ClientOptions` or
121
+
by using `sentrylogrus.NewLogHookFromClient()` and passing an already created `sentry.Client`. These hook captures log entries and
For comprehensive logging setup with Logrus, including advanced configuration options and best practices, see the [Go Logs documentation](/platforms/go/logs/). The Logrus integration shown above provides seamless integration with Sentry's structured logging features.
0 commit comments