Skip to content

Commit

Permalink
fix: taro js侧日志打印改造
Browse files Browse the repository at this point in the history
  • Loading branch information
Pzx-00100 committed Mar 28, 2024
1 parent c67fbae commit f34425b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/taro-mpharmony/src/api/network/request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class RequestTask {
this.headersCallback.delete(callback)
} else {
// eslint-disable-next-line no-console
console.log('offHeadersReceived callback invalid')
console.debug('offHeadersReceived callback invalid')
}
}
}
7 changes: 3 additions & 4 deletions packages/taro-mpharmony/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function logFun (funObj, message) {
return new Proxy(funObj, {
apply (target, thisArg, args) {
// eslint-disable-next-line no-console
console.log(`${message}, 参数为 ${safeStringify(args)}`)
console.debug('%s, 参数为 %s', message, safeStringify(args))
return target.apply(thisArg, args)
}
})
Expand All @@ -31,7 +31,7 @@ function logObj (obj) {
const value = target[property]
// @ts-ignore
// eslint-disable-next-line no-console
console.log(`调用 native ${property} property,结果为:${safeStringify(value)} `)
console.debug('调用 native %o property,结果为:%s} ', property, safeStringify(value))
return value
}

Expand All @@ -53,9 +53,8 @@ function logObj (obj) {
}

const result = target[property].apply(this, args)
log = `${log}, 返回值为${safeStringify(result)}`
// eslint-disable-next-line no-console
console.log(`${log}`)
console.debug('%s, 返回值为: %s', log, safeStringify(result))
return result
}
}
Expand Down

0 comments on commit f34425b

Please sign in to comment.