From 1bfb380b2e63bfc064fa89ddaccaac7ab0377d6a Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 5 Jun 2025 17:13:04 -0300 Subject: [PATCH 1/3] add react native docs --- docs/platforms/react-native/logs/index.mdx | 36 +++++++++++++++++++ .../logs/integrations/react-native.mdx | 1 + .../logs/options/react-native.mdx | 29 +++++++++++++++ .../logs/requirements/react-native.mdx | 1 + platform-includes/logs/setup/react-native.mdx | 9 +++++ platform-includes/logs/usage/react-native.mdx | 1 + 6 files changed, 77 insertions(+) create mode 100644 docs/platforms/react-native/logs/index.mdx create mode 100644 platform-includes/logs/integrations/react-native.mdx create mode 100644 platform-includes/logs/options/react-native.mdx create mode 100644 platform-includes/logs/requirements/react-native.mdx create mode 100644 platform-includes/logs/setup/react-native.mdx create mode 100644 platform-includes/logs/usage/react-native.mdx diff --git a/docs/platforms/react-native/logs/index.mdx b/docs/platforms/react-native/logs/index.mdx new file mode 100644 index 0000000000000..99f7146c06e97 --- /dev/null +++ b/docs/platforms/react-native/logs/index.mdx @@ -0,0 +1,36 @@ +--- +title: Set Up Logs +sidebar_title: Logs +description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." +sidebar_order: 5755 +notSupported: + - javascript.deno + - javascript.cordova + - javascript.capacitor +--- + + + + + +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. + +## Requirements + + + +## Setup + + + +## Usage + + + +## Integrations + + + +## Options + + diff --git a/platform-includes/logs/integrations/react-native.mdx b/platform-includes/logs/integrations/react-native.mdx new file mode 100644 index 0000000000000..64d1443ff7099 --- /dev/null +++ b/platform-includes/logs/integrations/react-native.mdx @@ -0,0 +1 @@ + diff --git a/platform-includes/logs/options/react-native.mdx b/platform-includes/logs/options/react-native.mdx new file mode 100644 index 0000000000000..26cb75ac3822e --- /dev/null +++ b/platform-includes/logs/options/react-native.mdx @@ -0,0 +1,29 @@ +#### beforeSendLog + +To filter logs, or update them before they are sent to Sentry, you can use the `_experiments.beforeSendLog` option. + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + _experiments: { + enableLogs: true, + beforeSendLog: (log) => { + if (log.level === "info") { + // Filter out all info logs + return null; + } + + return log; + }, + }, +}); +``` + +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. + +The log object has the following properties: + +- `level`: (string - one of `trace`, `debug`, `info`, `warn`, `error`, `fatal`) The log level. +- `message`: (string) The message to be logged. +- `timestamp`: (number) The timestamp of the log. +- `attributes`: (object) The attributes of the log. diff --git a/platform-includes/logs/requirements/react-native.mdx b/platform-includes/logs/requirements/react-native.mdx new file mode 100644 index 0000000000000..3c50de01f3793 --- /dev/null +++ b/platform-includes/logs/requirements/react-native.mdx @@ -0,0 +1 @@ +Logs for React Native are supported in Sentry React Native SDK version `7.0.0-beta.1` and above. diff --git a/platform-includes/logs/setup/react-native.mdx b/platform-includes/logs/setup/react-native.mdx new file mode 100644 index 0000000000000..6d407dfbcd041 --- /dev/null +++ b/platform-includes/logs/setup/react-native.mdx @@ -0,0 +1,9 @@ +To enable logging, you need to initialize the SDK with the `_experiments.enableLogs` option set to `true`. + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + // Enable logs to be sent to Sentry + _experiments: { enableLogs: true }, +}); +``` diff --git a/platform-includes/logs/usage/react-native.mdx b/platform-includes/logs/usage/react-native.mdx new file mode 100644 index 0000000000000..ab3da25535c2b --- /dev/null +++ b/platform-includes/logs/usage/react-native.mdx @@ -0,0 +1 @@ + From 6357b84aec260083dfff5dc96df38baf11f08d8e Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 5 Jun 2025 17:17:32 -0300 Subject: [PATCH 2/3] remove js filters --- docs/platforms/react-native/logs/index.mdx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/platforms/react-native/logs/index.mdx b/docs/platforms/react-native/logs/index.mdx index 99f7146c06e97..68979b4402064 100644 --- a/docs/platforms/react-native/logs/index.mdx +++ b/docs/platforms/react-native/logs/index.mdx @@ -3,11 +3,6 @@ title: Set Up Logs sidebar_title: Logs description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." sidebar_order: 5755 -notSupported: - - javascript.deno - - javascript.cordova - - javascript.capacitor ---- From 9dade51bd12593861e4e1383f6fd957c07a949db Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 5 Jun 2025 17:38:42 -0300 Subject: [PATCH 3/3] fix nit --- docs/platforms/react-native/logs/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/platforms/react-native/logs/index.mdx b/docs/platforms/react-native/logs/index.mdx index 68979b4402064..c29b2e4e3308b 100644 --- a/docs/platforms/react-native/logs/index.mdx +++ b/docs/platforms/react-native/logs/index.mdx @@ -3,6 +3,7 @@ title: Set Up Logs sidebar_title: Logs description: "Structured logs allow you to send, view and query logs sent from your applications within Sentry." sidebar_order: 5755 +---