Sentry-javascript: Document Raven.debug

Created on 24 Oct 2014  路  11Comments  路  Source: getsentry/sentry-javascript

I was not able to find any details regarding Raven.debug in the documentation, save for the changelog.

Most helpful comment

@nicbou How are you redirecting logging to the console when developing locally? Comment from https://github.com/getsentry/raven-node/issues/5#issuecomment-5854977 seems to indicate this is out of the scope of Raven and we should create a wrapper library.

All 11 comments

@nicbou There's no documentation because it was slapped in to solve one person's request. I don't really know what all it'd be for yet, so it's not something I'm recommending using yet. It will get documented when it has more value to it.

What were you looking into it for? Just out of curiosity.

I was looking to disable Raven.js logging when debugging our web application (or output it to console only). I think it makes sense to have the documented feature as it was undoubtedly the cleanest way to do this.

@nicbou And that's the problem, that's not what Raven.debug does, but it should do this in the future. This is why it's not documented since it doesn't really do much yet. Ideally it'd cover the full reporting, just noops at the end and doesn't actually send anything.

@nicbou Also, the preferred way to disable it entirely for debugging is to pass a falsey DSN through Raven.config() and that'll noop everything.

So you can do like, Raven.config('') or Raven.config(false)

Thanks for the reply. In that scenario, it might be worth documenting that solution.

Same issue here ... i really need to disable sentry for env like in local or dev server ... but setting Raven.config(false) prevent angular module to initiate....

@nicbou How are you redirecting logging to the console when developing locally? Comment from https://github.com/getsentry/raven-node/issues/5#issuecomment-5854977 seems to indicate this is out of the scope of Raven and we should create a wrapper library.

Unfortunately, that was a long time ago at another company, so I don't really remember.

d0077c117001e2e4ac56bf5265e3c88569b9c45d

I was looking to disable Raven.js logging when debugging our web application (or output it to console only). I think it makes sense to have the documented feature as it was undoubtedly the cleanest way to do this.

You can achieve this by doing something along these lines :

Raven.config('__DSN__', {
  dataCallback (data) {
    console.log(data.message) // log the full data object to see what field(s) you need
    return data;
  },
  shouldSendCallback () {
    return false
  }
}).install();
Was this page helpful?
0 / 5 - 0 ratings