diff --git a/docs/platforms/react-native/logs/index.mdx b/docs/platforms/react-native/logs/index.mdx new file mode 100644 index 0000000000000..c29b2e4e3308b --- /dev/null +++ b/docs/platforms/react-native/logs/index.mdx @@ -0,0 +1,32 @@ +--- +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 +--- + + + + + +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/docs/product/explore/logs/getting-started/index.mdx b/docs/product/explore/logs/getting-started/index.mdx index ccfe96c53325a..24c36381a02ab 100644 --- a/docs/product/explore/logs/getting-started/index.mdx +++ b/docs/product/explore/logs/getting-started/index.mdx @@ -198,6 +198,11 @@ To set up Sentry Logs, use the links below for supported SDKs. After it's been s label="Flutter" url="/platforms/dart/guides/flutter/logs/" /> +- ### PHP @@ -250,11 +255,6 @@ We're actively working on adding Log functionality to additional SDKs. Check out label="Laravel" url="https://github.com/getsentry/sentry-laravel/issues/999" /> -- - 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 @@ +