change cclog's color to grey
This commit is contained in:
parent
dab746a148
commit
4077faf829
10
index.js
10
index.js
@ -22,13 +22,13 @@ export default {
|
||||
cclog(...args) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const pageName = this.thisPage()?.route || 'VueApp'
|
||||
console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:green', ...args)
|
||||
console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:grey', ...args)
|
||||
}
|
||||
},
|
||||
ccinfo(...args) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const pageName = this.thisPage()?.route || 'VueApp'
|
||||
console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:blue', ...args)
|
||||
console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:green', ...args)
|
||||
}
|
||||
},
|
||||
ccwarn(...args) {
|
||||
@ -143,7 +143,8 @@ export default {
|
||||
* - CLINET_BACKEND_EXCEPTION: 前端发现后台异常
|
||||
**/
|
||||
async callBackend({ backend = this.BACKEND, httpMethod = 'POST', apiVersion = 'api', apiWho, apiTodo, apiWhat = {} }) {
|
||||
process.env.NODE_ENV === 'production' || console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + ' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }), 'color:green', 'background:SkyBlue')
|
||||
process.env.NODE_ENV === 'production'
|
||||
|| console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + ' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }), 'color:SkyBlue', 'background:SkyBlue')
|
||||
let result = {}
|
||||
if (backend === 'UNICLOUD') {
|
||||
let { /* success, header, requestedId, */ result: resultCloud = {} } = await uniCloud
|
||||
@ -196,7 +197,8 @@ export default {
|
||||
}
|
||||
// 注意1,resultServer 和 resultCloud 推荐遵循同样的格式 { _state, error | data },这样方便前端做统一判断。
|
||||
// 注意2,虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null,那么 resultServer/resultCloud 也是 null。
|
||||
process.env.NODE_ENV === 'production' || console.info(' %c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + '%c '+ JSON.stringify(result), 'color:green', 'background:PapayaWhip') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
|
||||
process.env.NODE_ENV === 'production'
|
||||
|| console.info(' %c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + '%c '+ JSON.stringify(result), 'color:PapayaWhip', 'background:PapayaWhip') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
|
||||
return result
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user