Allow configuring which console calls capture breadcrumb
See original GitHub issueDo you want to request a feature or report a bug? Request a feature
What is the current behavior?
Using existing configuration one can only turn autoBreadcrumbs.console
on or off. There’s no precise control over which console functions are capturing breadcrumb and which don’t.
What is the expected behavior? There should be a way to express which console methods are expected to capture a breadcrumb.
My use case: I use console.debug in my app but I don’t want those to be sent to Sentry. I see I have a few options:
- I can eliminate certain console calls as a build step so that they just aren’t there on stages and production
- I can use
breadcrumbCallback
to find and eliminate crumbs ofcategory: 'console'
andlevel: 'debug'
. Although it’s a great way, it took me some time to figure out that what I want is doable viabreadcrumbCallback
I think the following should be considered:
In config
autoBreadcrumbs: {
console: true | false | object
}
If object
then the following object can be passed:
{
debug: true (default) | false,
info: true (default) | false,
log: true (default) | false,
warn: true (default) | false,
error: true (default) | false,
... (any other key, if true, will be treated as console method name)
}
Pros:
- it will be immediately discoverable which console methods will and which won’t
- defaults can be omitted (as it is now for defaults of
autoBreadcrumbs
)
Cons:
- there should be additional check for presence of a console method before it’s wrapped to prevent misconfiguration. In fact there’s one already in the condition for
autoBreadcrumbs.console
, where presence ofconsole.log
is checked.
Summing things up:
- passing
false
as value for keys corresponding with 5 default console methods will disable capturing breadcrumb for them - passing
true
as value for keys not being within 5 default, but present onconsole
object and being functions will result in capturing breadcrumbs for that method
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
Breadcrumbs for JavaScript | Sentry Documentation
Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. These events are very similar to traditional logs,...
Read more >Capturing Events with Breadcrumbs - Javascript Honeybadger ...
Honeybadger captures many types of breadcrumbs automatically, such as click events, console logs, and Ajax requests. You can enhance your ability to rapidly ......
Read more >Configuration options - Ember - Bugsnag docs
navigation breadcrumbs are left on page loads, DOMContentLoaded events, pushState / replaceState calls, and popstate / hashchange events. Network requests.
Read more >Default Integrations for JavaScript - DocBase AI Documentation
This integration wraps native APIs to capture breadcrumbs. ... { // Log calls to `console.log`, `console.debug`, etc console: boolean; // Log all click...
Read more >Customize your Firebase Crashlytics crash reports - Google
Catch up on everything announced at Firebase Summit, and learn how Firebase ... of an existing key by calling the key and setting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kamilogorek no, just want to disable the
console
logs. Would that be enough -Thanks for the help 😃
@didnotwant you can use
beforeBreadcrumb
oreventProcessor
to filter out those you don’t want for some reason.In Breadcrumbs integration code you can see that it passes the
level
value in theSentryBreadcrumbHint
object toBreadcrumbs.addBreadcrumb
:https://github.com/getsentry/sentry-javascript/blob/65965ff30b4c978c4f200ef8bb5c88d220059324/packages/browser/src/integrations/breadcrumbs.ts#L118-L160
You can use the hind to prevent the breadcrumb from being sent