Skip to content

Commit

Permalink
日志级别调整,增加system
Browse files Browse the repository at this point in the history
  • Loading branch information
yafoo committed Feb 22, 2024
1 parent abcdf54 commit ab40a62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ class Logger
}
}

/**
* 输出system日志
* @public
* @static
* @param {...any} args
*/
static system(...args) {
this.log('system', ...args);
}

/**
* 输出error日志
* @public
Expand Down
10 changes: 5 additions & 5 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

// 设置根加载器
Expand Down

0 comments on commit ab40a62

Please sign in to comment.