1.1.2 • Published 1 year ago

emnj-sentry v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

emnj-sentry

文档地址

使用文档

安装

# npm
npm i emnj-sentry
# yarn
yarn add emnj-sentry
# pnpm
pnpm install emnj-sentry

使用

初始化

import * as Sentry from "emnj-sentry";
import Vue from 'vue'
import Router from "vue-router";

Vue.use(Router);

const router = new Router({
  // ...
});


// vue2 初始化sentry
Sentry.startSentry({
  Vue,
  dsn: "https://aa2a36973ce4*************8bac3d91c126@fenewmonitor.eastmoney.com/8",
  // 允许错误上报的域名,默认eastmoney.com,dfcfw.com,当前域名
  allowDomains: [
    "localhost",
    "127.0.0.1",
    "172.31.236.33",
    /^https:\/\/172.31.236.33:5173\.io\/api/
  ],
  // "production" | "test" | "beta"
  environment: "beta"
}, router);

vue3

import * as Sentry from "emnj-sentry";
import { createApp } from 'vue';
import { createRouter } from "vue-router";

// 创建 Vue 应用实例
const app = createApp({
 //...
});
const router = createRouter({
  // ...
});

// vue3 初始化sentry
Sentry.startSentry({
  app: app,
  dsn: "https://aa2a36973ce4*************8bac3d91c126@fenewmonitor.eastmoney.com/8",
  // 允许错误上报的域名,默认eastmoney.com,dfcfw.com,当前域名
  allowDomains: [
    "localhost",
    "127.0.0.1",
    "172.31.236.33",
    /^https:\/\/172.31.236.33:5173\.io\/api/
  ],
  // "production" | "test" | "beta"
  environment: "beta"
}, router);

其他操作

// 设置tag,方便管理后端查询
Sentry.setTags({ 
  tag1: "tag1", 
  tag2: "tag2",  
  // ...
});

// 设置用户信息,方便管理平台查询
Sentry.setUser({
  username: "test-username",
  id: "id-uid",
  email: "xxx@xxx.com",
  code: "code"
  // ...
});

// 手动上报信息
Sentry.sendMessage("请求接口报错了,跑路0018", 'warning');

// 手动使用sendException函数上报异常
const error = new Error("这是一个严重的错误000");
Sentry.sendException(error);

如何上传source maps

参考:如何上传source maps

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago