Skip to content

Commit ff98053

Browse files
authored
Add snippet about JS loader and update logging integration links (#13738)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR - Add snippet about js loader support w/ logs - Add links to upcoming android logging integrations - Update prose for Java logging integrations - Format go logs doc and add upcoming go logging integrations ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+
1 parent e158cc3 commit ff98053

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ the `sentry.Logger` API.
4747
The `Sentry.Logger` API exposes methods that support six different log levels: `trace`,
4848
`debug`, `info`, `warn`, `error` and `fatal`. The methods support both `fmt.Print` and `fmt.Printf` like syntax.
4949
If you pass in format specifiers like `%v`, these will be sent to Sentry, and can be searched from within the Logs UI,
50-
and even added to the Logs views as a dedicated column.
50+
and even added to the Logs views as a dedicated column.
5151

5252
```go
5353
ctx := context.Background()
@@ -58,6 +58,7 @@ logger.Info(ctx, "Hello ", "world!")
5858
// Or like [fmt.Printf]
5959
logger.Infof(ctx, "Hello %v!", "world")
6060
```
61+
6162
You can also pass additional attributes to the logger via the `SetAttributes` function. These attributes will also be searchable in the Logs UI.
6263

6364
```go
@@ -92,10 +93,13 @@ func main() {
9293
logger.Warnf(ctx, "I have params: %v and attributes", "example param")
9394
}
9495
```
96+
9597
Currently the `attribute` API supports only these value types: `int`, `string`, `bool`, and `float`.
9698

9799
## Integrations
98100

101+
### `io.Writer` interface
102+
99103
The `sentry.Logger` implements the `io.Writer` interface, so you can easily inject the logger into your existing setup.
100104

101105
```go
@@ -108,16 +112,24 @@ slogger.Info("Implementing slog.Logger")
108112
```
109113

110114
<Alert>
111-
In order to properly attach the correct trace with each Log entry, a `context.Context` is required. The `Write` function of
112-
the `io.Writer` interface doesn't provide `context`, so wrapping the custom logger will not get the trace and current span attached.
113-
We recommend using the `sentry.Logger` to ensure your logs are connected to spans and errors in the Sentry UI.
115+
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.
114121
</Alert>
115122

123+
### Upcoming Integrations
124+
125+
We're actively working on adding more integration support for Logs. Currently we are looking at adding support for [`slog`](https://pkg.go.dev/log/slog), [`logrus`](https://pkg.go.dev/github.com/sirupsen/logrus), and [`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.
126+
116127
## Options
117128

118129
### BeforeSendLog
119130

120131
To filter logs, or update them before they are sent to Sentry, you can use the `BeforeSendLog` client option.
132+
121133
```go
122134
if err := sentry.Init(sentry.ClientOptions{
123135
Dsn: "___PUBLIC_DSN___",
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
We are still working on Logs. Please open [a new GitHub issue](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see.
1+
We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see.
2+
3+
- [Timber](https://github.com/getsentry/sentry-java/issues/4407)
4+
- [Logcat](https://github.com/getsentry/sentry-java/issues/4408)

platform-includes/logs/integrations/java.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
We are still working on Logs. You can follow progress on the following GitHub issues or open a new one for any integration you would like to see.
1+
We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see.
22

33
- [Logback](https://github.com/getsentry/sentry-java/issues/4404)
44
- [Log4j2](https://github.com/getsentry/sentry-java/issues/4403)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
Logs for JavaScript are supported in Sentry JavaScript SDK version `9.17.0` and above.
2+
3+
<PlatformSection supported={["javascript"]}>
4+
5+
<Alert level="warning">
6+
7+
Logging is not supported in the [loader or CDN script](/platforms/javascript/install/loader/) for browser JavaScript. We recommend installing the SDK via [NPM](/platforms/javascript/install/npm/) to use logging. We are tracking support for the loader and CDN script in [this GitHub issue](https://github.com/getsentry/sentry-javascript/issues/16314).
8+
9+
</Alert>
10+
11+
</PlatformSection>

0 commit comments

Comments
 (0)