Skip to content

Commit

Permalink
[rum] modified docs on simultaneous logging (#879)
Browse files Browse the repository at this point in the history
* [rum] modified docs on simultaneous logging

* [rum] fix format

* Update packages/logs/README.md

Co-authored-by: Jorie Helwig <[email protected]>

Co-authored-by: Jorie Helwig <[email protected]>
  • Loading branch information
Hugo Delaby and jtappa authored Jun 7, 2021
1 parent 54b50b2 commit 7920082
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,14 @@ window.DD_LOGS && DD_LOGS.logger.setLevel('<LEVEL>')

### Change the destination

By default, loggers created by the Datadog browser logs SDK are sending logs to Datadog. After the Datadog browser logs SDK is initialized, it is possible to configure the logger to send logs to the `console`, or to not send logs at all (`silent`) using to the API:
By default, loggers created by the Datadog browser logs SDK are sending logs to Datadog. After the Datadog browser logs SDK is initialized, it is possible to configure the logger to:

- send logs to the `console` and Datadog (`http`)
- send logs to the `console` only
- not send logs at all (`silent`)

```
setHandler (handler?: 'http' | 'console' | 'silent')
setHandler (handler?: 'http' | 'console' | 'silent' | Array<handler>)
```

##### NPM
Expand All @@ -562,6 +566,7 @@ For NPM, use:
import { datadogLogs } from '@datadog/browser-logs'

datadogLogs.logger.setHandler('<HANDLER>')
datadogLogs.logger.setHandler(['<HANDLER1>', '<HANDLER2>'])
```

#### CDN async
Expand All @@ -571,6 +576,7 @@ For CDN async, use:
```javascript
DD_LOGS.onReady(function () {
DD_LOGS.logger.setHandler('<HANDLER>')
DD_LOGS.logger.setHandler(['<HANDLER1>', '<HANDLER2>'])
})
```

Expand All @@ -582,6 +588,7 @@ For CDN sync, use:

```javascript
window.DD_LOGS && DD_LOGS.logger.setHandler('<HANDLER>')
window.DD_LOGS && DD_LOGS.logger.setHandler(['<HANDLER1>', '<HANDLER2>'])
```

**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the SDK.
Expand Down

0 comments on commit 7920082

Please sign in to comment.