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); } // 设置根加载器