title: Vue项目集成Sentry错误跟踪平台
tags:
- 前端
- Vue
- Sentry
categories: - 前端
date: 2019-09-29 13:15:00
去搭建好的Sentry上,新建一个项目
安装依赖包
@sentry/browser
# Using yarn
$ yarn add @sentry/browser
# Using npm
$ npm install @sentry/browser
- 安装依赖包
sentry/integrations
# Using yarn
yarn add @sentry/integrations
# Using npm
npm install @sentry/integrations
main.js
引入
import Vue from 'vue'
import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';
Sentry.init({
dsn: 'http://d1701e1878654456aa94ce87f894a474:d0f97709732c476a850ca9ffb4f0fc82@127.0.0.1:9000/10',
integrations: [new Integrations.Vue({ Vue, attachProps: true })]
})
注意:
dsn
格式是:{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}/{PATH}{PROJECT_ID}
,别搞错。