51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import { useStarCloudStore } from '@/starCloud/starCloud'
|
|
|
|
const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null
|
|
|
|
export default {
|
|
debug() {
|
|
if (!log) return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
// eslint-disable-next-line prefer-spread,prefer-rest-params
|
|
log.debug.apply(log, arguments)
|
|
},
|
|
info() {
|
|
if (!log) return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
// eslint-disable-next-line prefer-spread,prefer-rest-params
|
|
log.info.apply(log, arguments)
|
|
},
|
|
warn() {
|
|
if (!log) return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
// eslint-disable-next-line prefer-spread,prefer-rest-params
|
|
log.warn.apply(log, arguments)
|
|
},
|
|
error() {
|
|
if (!log) return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
// eslint-disable-next-line prefer-spread,prefer-rest-params
|
|
log.error.apply(log, arguments)
|
|
},
|
|
setFilterMsg(msg) {
|
|
// 从基础库2.7.3开始支持
|
|
if (!log || !log.setFilterMsg) return
|
|
if (typeof msg !== 'string') return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
log.setFilterMsg(msg)
|
|
},
|
|
addFilterMsg(msg) {
|
|
// 从基础库2.8.1开始支持
|
|
if (!log || !log.addFilterMsg) return
|
|
if (typeof msg !== 'string') return
|
|
const $starCloud = useStarCloudStore()
|
|
if (!$starCloud.isReportLog) return
|
|
log.addFilterMsg(msg)
|
|
}
|
|
}
|