From ab40a627b34073c1ca3dfa2f1247f69a1ab237e9 Mon Sep 17 00:00:00 2001 From: yafu Date: Thu, 22 Feb 2024 15:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=8C=E5=A2=9E=E5=8A=A0system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/logger.js | 10 ++++++++++ lib/run.js | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/logger.js b/lib/logger.js index 5f6d496..9bca1c1 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -22,6 +22,16 @@ class Logger } } + /** + * 输出system日志 + * @public + * @static + * @param {...any} args + */ + static system(...args) { + this.log('system', ...args); + } + /** * 输出error日志 * @public diff --git a/lib/run.js b/lib/run.js index e6e3a81..b261540 100644 --- a/lib/run.js +++ b/lib/run.js @@ -8,11 +8,11 @@ const Logger = require('./logger'); async function run(ctx, next, control_type=cfg_app.controller_folder) { if(cfg_app.app_debug) { - Logger.debug(ctx.request); - Logger.debug(`Router(${control_type}): {APP: '${ctx.APP}', CONTROLLER: '${ctx.CONTROLLER}', ACTION: '${ctx.ACTION}'}`); - Object.keys(ctx.params).length && Logger.debug({Params: ctx.params}); - Object.keys(ctx.query).length && Logger.debug({Get: ctx.query}); - Object.keys(ctx.request.body || {}).length && Logger.debug({Post: ctx.request.body}); + Logger.http('Request:', ctx.request); + Logger.http(`Router(${control_type}): {APP: '${ctx.APP}', CONTROLLER: '${ctx.CONTROLLER}', ACTION: '${ctx.ACTION}'}`); + Object.keys(ctx.params).length && Logger.http('Params:', ctx.params); + Object.keys(ctx.query).length && Logger.http('Get:', ctx.query); + Object.keys(ctx.request.body || {}).length && Logger.http('Post:', ctx.request.body); } // 设置根加载器