Sentry is an open source monitoring system that supports server-side and client-side monitoring, as well as a powerful background error analysis and alarm platform. Similar to the logging function in the background.

Sentry is a bit unstable and often disconnects. Be careful not to open an ad-blocking plugin and be sure to click accept below when logging in

Usage:

  1. Set up an account on Sentry’s website. It is recommended that you log in using your Github account.

  2. Create a project, using vue3 as an example, and add the code to main.js

import * as Sentry from "@sentry/vue"; import { Integrations } from "@sentry/tracing"; Sentry. Init ({app, DSN: "you create project DSN address," integrations: [new integrations. BrowserTracing ({routingInstrumentation: Sentry.vueRouterInstrumentation(router), tracingOrigins: ["localhost", "my-site-url.com", /^\//], }), ], // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance Monitoring This value in production tracesSampleRate: 1.0,});Copy the code
  1. Throw an error in your code and view it in the Sentry panel
<a-button type="primary" @click="clickThrowError"> const clickThrowError = ()=>{throw new Error(' throw an Error '); }Copy the code

Code example address

Refer to the article