u
This commit is contained in:
parent
33ef8eff54
commit
405c352fc5
@ -1,5 +1,7 @@
|
||||
const colors = require('colors')
|
||||
|
||||
// HBuilder 内置环境的 console 不支持颜色。为了检查是否支持颜色,可测试 uniCloud 是否存在(不存在说明在自己的server环境里),或 require('supports-color'),相应的返回不同的 ccXXX 函数。
|
||||
|
||||
module.exports = {
|
||||
cclog(...args) {
|
||||
console.log(colors.blue({timeiso: new Date().toJSON()}), ...args)
|
||||
@ -13,7 +15,7 @@ module.exports = {
|
||||
ccwarn(...args) { // console.warn will appear in pm2's error log
|
||||
console.warn(colors.yellow({timeiso: new Date().toJSON()}), ...args)
|
||||
},
|
||||
ccdev(...args) {
|
||||
'development'===process.env.NODE_ENV && console.log(colors.cyan({timeiso: new Date().toJSON()}), ...args)
|
||||
ccdebug(...args) {
|
||||
'development'===process.env.NODE_ENV && console.log(colors.rainbow(JSON.stringify({timeiso: new Date().toJSON()})), ...args)
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
|
||||
module.exports = {
|
||||
cclog(...args) {
|
||||
console.log({timeiso: new Date().toJSON(), backend: 'UNICLOUD'}, ...args)
|
||||
},
|
||||
ccinfo(...args) {
|
||||
console.info({timeiso: new Date().toJSON(), backend: 'UNICLOUD'}, ...args)
|
||||
},
|
||||
ccerr(...args) { // console.error will appear in pm2's error log
|
||||
console.error({timeiso: new Date().toJSON(), backend: 'UNICLOUD'}, ...args)
|
||||
},
|
||||
ccwarn(...args) { // console.warn will appear in pm2's error log
|
||||
console.warn({timeiso: new Date().toJSON(), backend: 'UNICLOUD'}, ...args)
|
||||
},
|
||||
ccdev(...args) {
|
||||
'development'===process.env.NODE_ENV && console.log({timeiso: new Date().toJSON()}, ...args)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user