Consola
Send logs from the Consola library to Sentry in React Native.
Sentry Logs
Enable the Sentry Logs feature with enableLogs: true in your Sentry.init call to unlock Sentry's full logging power. With Sentry Logs, you can search, filter, and analyze logs from across your entire application in one place.
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").
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").