diff --git a/unitool.js b/unitool.js index ca78630..dd41fd8 100644 --- a/unitool.js +++ b/unitool.js @@ -22,24 +22,24 @@ export default { // 输出命令行提示,可用来取代 console.log/info/warn/error cclog (...args) { const pageName = this.thisPage()?.route || 'VueApp' - console.log('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:blue', ...args) + console.log('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:blue;background:lightgrey', ...args) }, ccinfo (...args) { const pageName = this.thisPage()?.route || 'VueApp' - console.info('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:green', ...args) + console.info('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:green;background:lightgrey', ...args) }, ccwarn (...args) { const pageName = this.thisPage().route || 'VueApp' - console.warn('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:orange', ...args) + console.warn('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:orange;background:lightgrey', ...args) }, ccerror (...args) { const pageName = this.thisPage()?.route || 'VueApp' - console.error('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:red', ...args) + console.error('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:red;background:lightgrey', ...args) }, ccdebug (...args) { if (process.env.NODE_ENV !== 'production') { const pageName = this.thisPage()?.route || 'VueApp' - console.debug('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:cyan', ...args) + console.debug('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:cyan;background:lightgrey', ...args) } }, @@ -232,7 +232,7 @@ export default { JSON.stringify({ basendType, apiWho, apiTodo, apiWhat, url }) + ' %c ' + JSON.stringify(result), - 'color:blue', + 'color:blue;background:lightgrey', 'background:skyblue', 'background:magenta' ) // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。