更新记录
1.0.2(2023-10-16)
- 优化接口
1.0.1(2023-10-11)
- 优化内部逻辑
1.0.0(2023-10-11)
- Sentry闪退奔溃日志上报
- 设置用户信息
- 设置标签tag
- 设置上下文context
- 主动上报日志
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.6.8,Android:4.4,iOS:11,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
Sentry闪退奔溃日志上报设置用户信息标签tag上下文context自动主动上报日志
- 闪退奔溃日志自动上报
- 设置用户信息
- 设置标签tag
- 设置上下文context
- 主动上报日志
集成步骤
创建Android、iOS应用:https://wrs.sentry.io/projects/new/,
进入对应应用,在Settings->Client Keys(DSN)[SDK SETUP],找到DSN
import {
UTSSentry
} from "@/uni_modules/wrs-uts-sentry"
var params = {}
switch (uni.getSystemInfoSync().platform) {
// android
case 'android':
params.dsn = "https://2dce11c75ba2a8424fad5c5eef31c7b2@o202510.ingest.sentry.io/4506023259013120"
break;
// ios
default:
params.dsn = "https://3136fc21256efebbe9b2662ec29a3bf5@o202510.ingest.sentry.io/4506023363739648"
// params.debug = true
params.attachViewHierarchy = true
params.enablePreWarmedAppStartTracing = true
params.enableMetricKit = true
params.enableTimeToFullDisplayTracing = true
params.swiftAsyncStacktraces = true
break;
}
UTSSentry.sentryInit(JSON.stringify(params))
- 测试app闪退
该接口调用后app会闪退奔溃,闪退奔溃后重启app会自动上传日志到sertry
UTSSentry.testException()
var params = {}
params.userId = "123456"
params.username = "杀手"
params.ipAddress = "192.168.0.1"
params.segment = "广东省用户"
params.name = "张三"
params.geo = {
city: "广州",
countryCode: "86",
region:"天河"
}
UTSSentry.setUser(JSON.stringify(params))
UTSSentry.clearUser()
var params = {}
// message必填
params.message = "特大新闻"
params.comments = "吐了"
params.email = "252797991@qq.com"
params.name = "张三"
UTSSentry.userFeedback(JSON.stringify(params))
var params = {}
params.tag = { // tag的值只能是字符串
age: "20",
address: "广东"
}
UTSSentry.configureScope(JSON.stringify(params))
var params = {}
params.contexts = {
key: "info",
value: {
price: 23.0,
type: "walk"
}
}
UTSSentry.configureScope(JSON.stringify(params))