Commit 121fabba by 李伟康

chore: 注释掉Sentry相关的配置和上报代码

暂时禁用Sentry错误上报功能,注释初始化和调用逻辑
1 parent 4166c5af
......@@ -44,10 +44,10 @@ uni.signHttpConfig = {
sessionParamName: 'sessionId',
sessionId: _ => uni.$storage?.get('sessionId')
},
sentry: {
enable: true, // 是否启用Sentry错误上报
dsn: 'https://cce6491788ff4b8899d8f912e6982a96@sentry.glsx.com.cn/42'
},
// sentry: {
// enable: true, // 是否启用Sentry错误上报
// dsn: 'https://cce6491788ff4b8899d8f912e6982a96@sentry.glsx.com.cn/42'
// },
response: {
code_key: 'code',
code_success_value: '0',
......
......@@ -7,13 +7,13 @@
* @LastEditTime: 2026-01-22 16:21:17
* @FilePath: \gl_tape\utils\logger\RemoteLog.js
*/
import sentryInit from '@/utils/sentryConfig/sentryInit'
// import sentryInit from '@/utils/sentryConfig/sentryInit'
import { LogLevel , RemoteExtraDataKey} from './constants'
class RemoteLog {
sentry = null
constructor(user) {
this.sentry = sentryInit()
this.sentry.setUser(user)
// this.sentry = sentryInit()
// this.sentry.setUser(user)
}
debug(info) {
this.send(LogLevel.DEBUG, info)
......@@ -28,45 +28,45 @@ class RemoteLog {
this.send(LogLevel.ERROR, info)
}
send(level, { extra = {}, msg, tag = { key: '', value: '' } }) {
this.sentry.withScope(scope => {
// 1. 设置 Tag
if (tag && tag.key) {
scope.setTag(tag.key, tag.value)
}
// this.sentry.withScope(scope => {
// // 1. 设置 Tag
// if (tag && tag.key) {
// scope.setTag(tag.key, tag.value)
// }
// 2. 自动补充环境信息到 Extra
const systemInfo = uni.getSystemInfoSync()
const enhancedExtra = {
...extra,
device_brand: systemInfo.brand,
device_model: systemInfo.model,
os_name: systemInfo.osName, // uni-app x 支持,或用 platform
os_version: systemInfo.osVersion,
uni_platform: systemInfo.uniPlatform,
app_version: systemInfo.appVersion,
network_type: 'unknown' // 可选:尝试获取网络状态
}
// // 2. 自动补充环境信息到 Extra
// const systemInfo = uni.getSystemInfoSync()
// const enhancedExtra = {
// ...extra,
// device_brand: systemInfo.brand,
// device_model: systemInfo.model,
// os_name: systemInfo.osName, // uni-app x 支持,或用 platform
// os_version: systemInfo.osVersion,
// uni_platform: systemInfo.uniPlatform,
// app_version: systemInfo.appVersion,
// network_type: 'unknown' // 可选:尝试获取网络状态
// }
// 尝试获取网络状态(如果允许异步)
// uni.getNetworkType({ success: (res) => enhancedExtra.network_type = res.networkType })
// // 尝试获取网络状态(如果允许异步)
// // uni.getNetworkType({ success: (res) => enhancedExtra.network_type = res.networkType })
scope.setExtra(RemoteExtraDataKey, enhancedExtra)
// scope.setExtra(RemoteExtraDataKey, enhancedExtra)
// 3. 设置级别
scope.setLevel(level)
// // 3. 设置级别
// scope.setLevel(level)
// 4. 上报 (区分 Error 对象和普通消息)
// 如果 msg 本身就是 Error 对象,直接上报以保留堆栈信息
// 如果是字符串,则包装成 Error
if (msg instanceof Error) {
this.sentry.captureException(msg)
} else {
// 将字符串消息作为 Error 的 message,这样在 Sentry 面板中更直观
const error = new Error(String(msg))
// 可以手动尝试附加调用栈(虽然 new Error 已经有了)
this.sentry.captureException(error)
}
})
// // 4. 上报 (区分 Error 对象和普通消息)
// // 如果 msg 本身就是 Error 对象,直接上报以保留堆栈信息
// // 如果是字符串,则包装成 Error
// if (msg instanceof Error) {
// this.sentry.captureException(msg)
// } else {
// // 将字符串消息作为 Error 的 message,这样在 Sentry 面板中更直观
// const error = new Error(String(msg))
// // 可以手动尝试附加调用栈(虽然 new Error 已经有了)
// this.sentry.captureException(error)
// }
// })
}
}
export default RemoteLog
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!