Optionaloptions: ConsolaReporterOptionsConfiguration options for the reporter.
A Consola reporter that can be added to consola instances.
import * as Sentry from '@sentry/node';
import { consola } from 'consola';
Sentry.init({
enableLogs: true,
});
const sentryReporter = Sentry.createConsolaReporter({
// Optional: filter levels to capture
levels: ['error', 'warn', 'info'],
});
consola.addReporter(sentryReporter);
// Now consola logs will be captured by Sentry
consola.info('This will be sent to Sentry');
consola.error('This error will also be sent to Sentry');
Creates a new Sentry reporter for Consola that forwards logs to Sentry. Requires the
enableLogsoption to be enabled.Note: This integration supports Consola v3.x only. The reporter interface and log object structure may differ in other versions of Consola.