Bugsnag-js: Can I disable the message "Session not sent due to..."?

Created on 27 Jul 2018  路  3Comments  路  Source: bugsnag/bugsnag-js

Expected behavior

I'd like to be able to disable the following logging message that I get when I disable reporting via releaseStage/notifyReleaseStages:

 Session not sent due to releaseStage/notifyReleaseStages configuration

Observed behavior

I am not sure how to do this.

Steps to reproduce

  1. Disable error reporting via releaseStage/notifyReleaseStages.
  2. Cause an error.

Version

4.7.2

Additional information

Thanks!

Most helpful comment

Hi @waynebloss, you can set logger: null in your configuration to switch off logging:

https://docs.bugsnag.com/platforms/browsers/js/configuration-options/#logger

Let me know if you need anything else!

All 3 comments

Hi @waynebloss, you can set logger: null in your configuration to switch off logging:

https://docs.bugsnag.com/platforms/browsers/js/configuration-options/#logger

Let me know if you need anything else!

But that will disable all logging. What if I want to disable those diagnostic errors?

We don't have granular configuration for every kind of log message. If you opt in to logging you get them all. That particular log message is a warn() so you could provide a custom logger that only logs error level.

function noop () {}
var logger = {
  debug: noop,
  info: noop,
  warn: noop,
  error: function () { console.log.apply(console, arguments) }
}

bugsnag({
  logger: logger
})

That is just one example. You could get more creative and filter out just the messages you don't want to see and continue to include debug/info logs. It's up to you!

Hope this helps.

Was this page helpful?
0 / 5 - 0 ratings