Skip to content

Commit 1bfb380

Browse files
add react native docs
1 parent fcae333 commit 1bfb380

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Set Up Logs
3+
sidebar_title: Logs
4+
description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry."
5+
sidebar_order: 5755
6+
notSupported:
7+
- javascript.deno
8+
- javascript.cordova
9+
- javascript.capacitor
10+
---
11+
12+
<PlatformContent includePath="llm-rules-logs" />
13+
14+
<Include name="feature-stage-beta-logs.mdx" />
15+
16+
With Sentry Structured Logs, you can send text based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes.
17+
18+
## Requirements
19+
20+
<PlatformContent includePath="logs/requirements" />
21+
22+
## Setup
23+
24+
<PlatformContent includePath="logs/setup" />
25+
26+
## Usage
27+
28+
<PlatformContent includePath="logs/usage" />
29+
30+
## Integrations
31+
32+
<PlatformContent includePath="logs/integrations" />
33+
34+
## Options
35+
36+
<PlatformContent includePath="logs/options" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Include name="logs/javascript-console-logging-integration.mdx" />
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#### beforeSendLog
2+
3+
To filter logs, or update them before they are sent to Sentry, you can use the `_experiments.beforeSendLog` option.
4+
5+
```js
6+
Sentry.init({
7+
dsn: "___PUBLIC_DSN___",
8+
_experiments: {
9+
enableLogs: true,
10+
beforeSendLog: (log) => {
11+
if (log.level === "info") {
12+
// Filter out all info logs
13+
return null;
14+
}
15+
16+
return log;
17+
},
18+
},
19+
});
20+
```
21+
22+
The `beforeSendLog` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it.
23+
24+
The log object has the following properties:
25+
26+
- `level`: (string - one of `trace`, `debug`, `info`, `warn`, `error`, `fatal`) The log level.
27+
- `message`: (string) The message to be logged.
28+
- `timestamp`: (number) The timestamp of the log.
29+
- `attributes`: (object) The attributes of the log.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Logs for React Native are supported in Sentry React Native SDK version `7.0.0-beta.1` and above.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
To enable logging, you need to initialize the SDK with the `_experiments.enableLogs` option set to `true`.
2+
3+
```js
4+
Sentry.init({
5+
dsn: "___PUBLIC_DSN___",
6+
// Enable logs to be sent to Sentry
7+
_experiments: { enableLogs: true },
8+
});
9+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Include name="logs/javascript-usage.mdx" />

0 commit comments

Comments
 (0)