-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Feature request] Add ability to configure log level for instrumentConsole #3946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can use the Sentry.init({
// ...
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === "console") {
// add logic to control what breadcrumbs are here
}
return breadcrumb;
},
}); See what it looks like here: sentry-javascript/packages/browser/src/integrations/breadcrumbs.ts Lines 132 to 141 in 1d1b41c
@kamilogorek Do you think we should expand the API to add this? Not sure if it's worth the bundle size increase. |
@AbhiPrasad Thanks for your reply. beforeBreadcrumb hook can be used to filter extra console methods, but with it I can`t add a trace level. Now as a workaround I use this after Sentry initialization: fill(global.console, 'trace', (originalConsoleLevel) => (message, ...args) => {
Sentry.addBreadcrumb({
category: 'console',
level: Sentry.Severity.Debug, // <-- there is not a trace severity, so debug is used
message,
data: { level: 'trace', args },
});
if (originalConsoleLevel) {
Function.prototype.apply.call(originalConsoleLevel, global.console, [message, ...args]);
}
}); |
@romap0 you can add
|
It would be useful to have the ability to pass console log methods which will be added to breadcrumbs.
For example:
The text was updated successfully, but these errors were encountered: