CaptureConsole | Sentry for Next.js
Source URL: https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/integrations/captureconsole
CaptureConsole | Sentry for Next.js
Section titled “CaptureConsole | Sentry for Next.js”Import name: Sentry.captureConsoleIntegration
This integration captures all Console API calls and redirects them to Sentry using the SDK’s captureMessage or captureException call, depending on the log level. It then re-triggers to preserve default native behavior:
import * as Sentry from "@sentry/browser";
Sentry.init({ dsn: "___PUBLIC_DSN___", integrations: [Sentry.captureConsoleIntegration()],});Type: string[]
Array of methods that should be captured. Defaults to ['log', 'info', 'warn', 'error', 'debug', 'assert']