Comments (5)
Could you handle your use case by having a setup like:
if (env.DATADOG_CLIENT_TOKEN) {
DD_LOGS.init({ clientToken: env.DATADOG_CLIENT_TOKEN, ...})
}
or is there something more to it?
from browser-sdk.
Hi @thaim,
What about not initialize browser logs when you don't want to use it?
from browser-sdk.
Feel free to reopen if needed.
from browser-sdk.
Hey @bcaudan. Thanks for your work on this. I agree with @thaim on this I really don't think this should be throwing an error in the console. In our company, we have some people that have the environment variables set locally because they use the tool, and many other developers that don't, and even the developers that don't use the tool see this error warning. In either case, it's a configuration, people don't have it set on purpose so would this be an easy update to just change this console.error to console.warn. Would really appreciate it. Thank you!
from browser-sdk.
Hi @bcaudan,
The thing is validation happen (validateAndBuildConfiguration
) before we decide which handler gonna be used. This means we should always specify clientToken
(it's mandatory) to be able to use logger, even if we need console
handler (e.g for dev environment), which does not require it.
The suggestion above does not work for such case, since we want to use logger (console
handler), however - it's not possible w/o clientToken
.
We can specify some random string (e.g 'empty') and everything works fine. However, I didn't find this in documentation so not sure it's correct.
// env.DATADOG_CLIENT_TOKEN is set for production only.
datadogLogs.init({
clientToken: env.DATADOG_CLIENT_TOKEN || 'empty',
...
})
datadogLogs.logger.setHandler(env.DATADOG_CLIENT_TOKEN ? 'http' : 'console')
datadogLogs.logger.setLevel(env.LOGGER_LEVEL)
In summary, it would be great to not specify clientToken
for console
handler if it's not used. Or maybe add a workaround with 'empty' string to the documentation. Does it make sense?
from browser-sdk.
Related Issues (20)
- 🙏 "Reached max sessionReplay events size queued for upload: 3MiB" meaning HOT 1
- 🙏 My support need HOT 3
- 💡 Prerendering support HOT 1
- 🐛 Track Click Action produces memory leak HOT 2
- 🙏 Inflated LCP + load time values HOT 2
- 🐛 Browser Logs SDK is constantly writing to _dd_s cookie HOT 4
- 🐛 API calls are not logged with withFetch() API in newer versions of Angular HOT 5
- Warnings on import: "SDK is loaded more than once. This is unsupported and might have unexpected behavior" HOT 4
- 🐛 Expiration of cookie __dd_s after setTrackingConsent('not-granted') call
- Invalid traceparent generated is causing dd-python library to throw errors HOT 3
- 🙏 Proxied RUM session replay fails to load in the dashboard HOT 2
- 🐛 Some requests being processed as both XHR and Fetch, produces duplicate headers HOT 3
- History API is wrapped wrong HOT 3
- 🐛 Warning message when setting Japanese tags HOT 3
- Support RUM work on Web-Worker HOT 1
- Response undefined in type=resource resource-type=XHR events HOT 2
- Client side page views seem to no longer be recognized (script tag version) HOT 4
- Reported error traces at Datadog RUM is truncated than original error traces of browser side. HOT 3
- 🐛 rum requests pending forever HOT 1
- 🐛 npm browser-logs 5.26.0 not compatible with v5/datadog-logs.js HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser-sdk.