1.0.0 • Published 3 years ago
@yhtl/browserdebug v1.0.0
web错误日志收集系统
在html顶部引入
<script src="path/to/browserDebug-iife.js"></script>
在入口文件出引入
improt browserLogs from "@yhtl/browserdebug";
配置
browserLogs.setConfig({
project: "testProject", // 项目名称
user: "xiaoming", // 用户id
reportUploadHost: "reportAddress", // 日志上报地址
isPersist: false, // 是否持久报错日志
storeLogSize: 100, // 日志记录长度
reportLogSize: 10, // 上报日志长度
reportProbability: 100, // 上报概率
})
日志收集内容
- 导航跳转
- console输出内容
- 用户点击信息
- 错误信息:资源加载错误、js报错、promise未捕获
- 网络请求信息:请求参数、返回内容、耗费时间
- 本地存储内容
- 浏览器信息
用户操作的时候记录以上信息遇见报错的时候上报
手动上报
browserLogs.report({
type: reportType,
title: string,
desc: string,
user?: string
})
enum reportType {
javascriptError = "javascriptError",
unhandledrejection = "unhandledrejection",
sourceError = "sourceError",
manual = "manual"
}
``
1.0.0
3 years ago