Bugsnag-js: Console log breadcrumb changes line number of log messages

Created on 27 Jul 2016  路  5Comments  路  Source: bugsnag/bugsnag-js

Because of we are overriding console.log to capture breadcrumbs, those messages when printed to the console get attributed to our script rather than the original source.

It would be nice to find a way to avoid this.

Most helpful comment

@ptrwtts

Yes, you can disable any of the automatic breadcrumbs https://docs.bugsnag.com/platforms/browsers/configuration-options/#autobreadcrumbs

in code:

Bugsnag.autoBreadcrumbsConsole = false;

as script tag attribute

<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-3.min.js"
        data-apikey="YOUR-API-KEY-HERE"
        data-autobreadcrumbsconsole="false"></script>

We're actually considering disabling the console breadcrumbs in development by default.

All 5 comments

Did a lot of searching on this problem. There are several ways to duplicate the original console.log function without altering the line number, but I haven't yet found an approach that let's you perform some logic before calling the original.

Some browsers have a feature called blackboxing which will allow people to ignore the bugsnag library in stacktraces, but this is less than ideal as it requires extra setup.

I need this functionality to debug an app. My standard method of logging to the console is useless without line numbers. Is there any way to disable this, at least during development, without completely turning off bugsnag?

@ptrwtts

Yes, you can disable any of the automatic breadcrumbs https://docs.bugsnag.com/platforms/browsers/configuration-options/#autobreadcrumbs

in code:

Bugsnag.autoBreadcrumbsConsole = false;

as script tag attribute

<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-3.min.js"
        data-apikey="YOUR-API-KEY-HERE"
        data-autobreadcrumbsconsole="false"></script>

We're actually considering disabling the console breadcrumbs in development by default.

For bugsnag via npm version 3.3.2 I was running into some issues.

For some reason Bugsnag. autoBreadcrumbsConsole = false was not doing anything and the console.logs still appeared in the bugsnag source code.

But Bugsang.disableAutoBreadcrumbsConsole() worked.

Looks like there was some changes to v4 so probably not relevant to people using that version.

馃憢 I've added the Bugsnag.disableAutoBreadcrumbsConsole() in my source code, yet it seems like the console is highjacked, is there a way to keep the original console?

image

In this case, bugsnag is inside a 3rd party lib that I control where it's initialized with Bugsnag.noConflict();

https://docs.bugsnag.com/platforms/browsers/v3/faq/#how-do-i-use-bugsnag-in-third-party-embedded-javascript

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathanwelch picture nathanwelch  路  6Comments

mdonjones picture mdonjones  路  5Comments

kilianc picture kilianc  路  5Comments

waynebloss picture waynebloss  路  3Comments

livthomas picture livthomas  路  4Comments