Skip to content

Commit

Permalink
Merge branch 'main' into bcaudan/high-value-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan authored Jun 7, 2021
2 parents 6667ae7 + 7920082 commit 45decaf
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 45decaf

Please sign in to comment.