41 lines
955 B
JavaScript
41 lines
955 B
JavaScript
import { isReportLog } from '@/starCloud/starCloud'
|
|
|
|
const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null
|
|
|
|
export default {
|
|
debug() {
|
|
if (!log) return
|
|
if (!isReportLog) return
|
|
log.debug.apply(log, arguments)
|
|
},
|
|
info() {
|
|
if (!log) return
|
|
if (!isReportLog) return
|
|
log.info.apply(log, arguments)
|
|
},
|
|
warn() {
|
|
if (!log) return
|
|
if (!isReportLog) return
|
|
log.warn.apply(log, arguments)
|
|
},
|
|
error() {
|
|
if (!log) return
|
|
if (!isReportLog) return
|
|
log.error.apply(log, arguments)
|
|
},
|
|
setFilterMsg(msg) {
|
|
// 从基础库2.7.3开始支持
|
|
if (!log || !log.setFilterMsg) return
|
|
if (typeof msg !== 'string') return
|
|
if (!isReportLog) return
|
|
log.setFilterMsg(msg)
|
|
},
|
|
addFilterMsg(msg) {
|
|
// 从基础库2.8.1开始支持
|
|
if (!log || !log.addFilterMsg) return
|
|
if (typeof msg !== 'string') return
|
|
if (!isReportLog) return
|
|
log.addFilterMsg(msg)
|
|
}
|
|
}
|