Console logging

Capture console API calls as Sentry logs in React Native.

Console Logging integration is enabled by default which means calls to the console API will be captured as logs in Sentry. By default the integration instruments console.debug, console.info, console.warn, console.error, console.log, console.trace, and console.assert.

To disable the integration, filter it out from the integrations array:

Copied
Sentry.init({
  ...,
  integrations(integrations) {
    return integrations.filter(i => i.name !== 'ConsoleLogs');
  },
  ...
})

You can also filter out the automatically captured logs in beforeSendLog:

Copied
Sentry.init({
  ...,
  beforeSendLog: (log) => {
    if (log.attributes?.['sentry.origin'] === 'auto.log.console') {
      return null;
    }
    return log;
  },
  ...
})
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").