Skip to content

Commit

Permalink
🎨 [RUM] Fix TSLint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
webNeat committed Nov 13, 2020
1 parent e97faca commit 6d4812f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ datadogLogs.setLoggerGlobalContext("{'env': 'staging'}")

datadogLogs.addLoggerGlobalContext('referrer', document.referrer)

datadogLogs.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
const context = datadogLogs.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
```

#### CDN async
Expand All @@ -372,7 +372,9 @@ DD_LOGS.onReady(function() {
window.DD_LOGS && DD_LOGS.addLoggerGlobalContext('referrer', document.referrer)
})

window.DD_LOGS && DD_LOGS.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
DD_LOGS.onReady(function() {
var context = window.DD_LOGS && DD_LOGS.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
})
```

**Note:** Early API calls must be wrapped in the `DD_LOGS.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
Expand All @@ -386,7 +388,7 @@ window.DD_LOGS && DD_LOGS.setLoggerGlobalContext({ env: 'staging' })

window.DD_LOGS && DD_LOGS.addLoggerGlobalContext('referrer', document.referrer)

window.DD_LOGS && DD_LOGS.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
var context = window.DD_LOGS && DD_LOGS.getLoggerGlobalContext() // => {env: 'staging', referrer: ...}
```

**Note**: The `window.DD_LOGS` check is used to prevent issues if a loading failure occurs with the library.
Expand Down
2 changes: 1 addition & 1 deletion packages/logs/src/boot/logs.entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export function makeLogsGlobal(startLogsImpl: StartLogs) {
isAlreadyInitialized = true
}),

setLoggerGlobalContext: monitor(globalContextManager.set),
getLoggerGlobalContext: monitor(globalContextManager.get),
setLoggerGlobalContext: monitor(globalContextManager.set),

addLoggerGlobalContext: monitor(globalContextManager.add),

Expand Down
2 changes: 1 addition & 1 deletion packages/rum/src/boot/rum.entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export function makeRumGlobal(startRumImpl: StartRum) {

removeRumGlobalContext: monitor(globalContextManager.remove),

setRumGlobalContext: monitor(globalContextManager.set),
getRumGlobalContext: monitor(globalContextManager.get),
setRumGlobalContext: monitor(globalContextManager.set),

getInternalContext: monitor((startTime?: number) => {
return getInternalContextStrategy(startTime)
Expand Down

0 comments on commit 6d4812f

Please sign in to comment.