diff --git a/includes/logs/default-attributes/integration-filter-example/javascript.mdx b/includes/logs/default-attributes/integration-filter-example/javascript.mdx new file mode 100644 index 0000000000000..bd50fd860da04 --- /dev/null +++ b/includes/logs/default-attributes/integration-filter-example/javascript.mdx @@ -0,0 +1,14 @@ +To filter out all SDK-generated logs and keep only your application logs, use the following snippet: + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + enableLogs: true, + beforeSendLog: (log) => { + if (log.attributes?.["sentry.origin"] !== undefined) { + return null; + } + return log; + }, +}); +``` diff --git a/platform-includes/logs/default-attributes/react-native.mdx b/platform-includes/logs/default-attributes/react-native.mdx index 6e2d611919d28..cc680cfa8d157 100644 --- a/platform-includes/logs/default-attributes/react-native.mdx +++ b/platform-includes/logs/default-attributes/react-native.mdx @@ -11,3 +11,14 @@ The React Native SDK automatically sets several default attributes on all log en + + + +### Log Object Properties + +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/options/react-native.mdx b/platform-includes/logs/options/react-native.mdx index 759530e608b30..ba2f914b0ae32 100644 --- a/platform-includes/logs/options/react-native.mdx +++ b/platform-includes/logs/options/react-native.mdx @@ -18,10 +18,3 @@ Sentry.init({ ``` 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.