Sentry tutorial/Handling client exception logging using the Sentry platform

Our client projects often encounter the need to record abnormal logs. Many mature platforms in China provide solutions. Today, our protagonist is Sentry + Javascript, whose free version of service can meet the practical application of small and medium-sized projects.

  • Set up an account

Go to the registration page to sign up for an account, or log in using your Github account.

  • Select the language

Once registered, select the Javascript language and click Create Project. (As shown below)

  • Follow the tutorial to introduce the correspondingscriptThe label
<script src="https://browser.sentry-cdn.com/5.6.3/bundle.min.js" integrity="xxx" crossorigin="anonymous">
</script>
Copy the code
  • Send initialization information
Sentry.init({ dsn: 'xxx' });
Copy the code
  • Execute a function that will throw errors
myUndefinedFunction();
Copy the code

At this time, a “Take Me to My Event” button will appear on the page according to the verification. Click to enter. (As shown below)

After entering the console, you can see that the exception log just output has been recorded in the console.

A simple Sentry service is ready to use!

Original address, welcome Star