sentry使用实践

sentry官网注册一个账号:https://sentry.io/organizations/northfed/projects/new/

先安装依赖(以下步骤在sentry里都有提示步骤的):

cnpm install @sentry/browser  
cnpm install @sentry/integrations

vue中main.js引入:

import Vue from 'vue';
import * as Sentry from '@sentry/browser';
import { Vue as VueIntegration } from '@sentry/integrations';

Sentry.init({
  dsn: 'https://[email protected]/5244239',
  integrations: [new VueIntegration({Vue, attachProps: true})],
});

 备注:dsn是创建sentry项目后动态生成的,类似百度的ak密钥标识当前项目。

下面截图sentry是创建一个项目和team:

 


效果:

控制台报错:

 sentry后台捕获报错:

就这么简单~!!

Sentry免费版可以:

  • 每月5k 错误日志上限
  • 支持所有平台和语言,功能无缩水
  • 无限项目数量,仅单用户访问,不提供团队功能

 具体的价格表可以看这里:

猜你喜欢

转载自www.cnblogs.com/ivan5277/p/12910452.html