se-report

0.0.1 • Public • Published

se-report -- 浏览器端sdk

前端日志上报与JS异常监控

Getting Started

se-report 必须在所有js前加载并初始化。

引入se-report

支持script以及模块化引入

<script src="//yun.tuipink.com/wawaji/se/se-report.0.1.0.min.js"></script>
初始化
SE_REPORT.init({
  pid: 'wawah5'                          // 不指定 id 将不上报
});
查看数据
  1. LogInsight查看 http://log-vpc.dui88.com/streams
  2. 页面直接查看 http://retcode.tuipink.com/debug

配置说明

BJ_REPORT.init({
  pid: 'wawah5',                        // 上报 id, 不指定 id 将不上报
  delay: 1000,                          // 当 combo 为 true 可用,延迟多少毫秒,合并缓冲区中的上报(默认)
  url: "//retcode.tuipink.com",         // 指定上报地址
  ignore: [/Script error/i],            // 忽略某个错误
  random: 1,                            // 抽样上报,1~0 之间数值,1为100%上报(默认 1)
  repeat: 5,                            // 重复上报次数(对于同一个错误超过多少次不上报)
                                        // 避免出现单个用户同一错误上报过多的情况
  ext: {}                               // 扩展属性,支持收集自定义数据
});
ext扩展
ext: {
  params: ['a_tuiaId', 'mediaId'],
  roomId: function() { return window.CFG.roomId; }
}

SE_Report 是重写了 window.onerror 进行上报的,无需编写任何捕获错误的代码

手动上报
SE_REPORT.report("error msg");
 
SE_REPORT.report({
  msg: "xx load error",                 // 错误信息
  target: "xxx.js",                     // 错误的来源js
  rowNum: 100,                          // 错误的行数
  colNum: 100,                          // 错误的列数
});
 
try{
    // something throw error ...
}catch(error){
    SE_REPORT.report(error);
}
 

Readme

Keywords

Package Sidebar

Install

npm i se-report

Weekly Downloads

2

Version

0.0.1

License

ISC

Last publish

Collaborators

  • inuanfeng