Consola

Send logs from the Consola library to Sentry in React Native.

In SDK version 10.12.0 and above, you can send logs to Sentry via the consola logging library.

Copied
import { consola } from "consola";

// Create a Sentry reporter for consola
const sentryReporter = Sentry.createConsolaReporter();

// Add the reporter to consola
consola.addReporter(sentryReporter);

The createConsolaReporter method accepts a levels option, which allows you to filter which levels are sent to Sentry. By default all levels are logged.

Copied
const sentryReporter = Sentry.createConsolaReporter({
  levels: ["error", "warn"],
});
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").