Takaro - v0.6.0
    Preparing search index...

    Function createConsolaReporter

    • Creates a new Sentry reporter for Consola that forwards logs to Sentry. Requires the enableLogs option 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.

      Parameters

      • Optionaloptions: ConsolaReporterOptions

        Configuration options for the reporter.

      Returns ConsolaReporter

      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');