Skip to content

Commit e07b5d8

Browse files
authored
feat: Add docs about console logging integration templating (#15028)
Documents getsentry/sentry-javascript#17703
1 parent d003634 commit e07b5d8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

includes/logs/javascript-console-logging-integration.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@ Sentry.init({
1313
```
1414

1515
The `consoleLoggingIntegration` accepts a `levels` option, which is an array of console method names to log. By default the integration will log calls from `console.debug`, `console.info`, `console.warn`, `console.error`, `console.log`, `console.assert`, and `console.trace`.
16+
17+
If you provide multiple arguments to your `console` object calls the integration will parse them as different attributes, which can be searched and filtered for in the Sentry UI. This requires SDK version [`10.13.0`](https://github.com/getsentry/sentry-javascript/releases/tag/10.13.0) or higher.
18+
19+
```js
20+
// This will be logged as:
21+
// {
22+
// "message": "Executed Action for User: 123 true",
23+
// "attributes": {
24+
// "message.template": "Executed Action for User: {} {}",
25+
// "message.parameter.0": 123,
26+
// "message.parameter.1": true
27+
// }
28+
// }
29+
console.log("Executed Action for User:", 123, true);
30+
```

0 commit comments

Comments
 (0)