Commit 121fabba by 李伟康

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

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