From 39ba7a436113da5dc5f9cf841ef94fd8ce98c8a3 Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Thu, 9 Jun 2022 11:24:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=97=A5=E5=BF=97=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=83=8C=E6=99=AF=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unitool.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 才按照期望输出。