UNPKG

autolog4j

Version:

> use

38 lines (33 loc) 659 B
### AUTOLOG4J > use ``` // 替换原有接口输出 let alog4j = require('autolog4j')(app); alog4j.use(app, 'info'); // 新的日志记录 alog4j.logger('logger-name').info('日志内容'); ``` ### 默认配置 ``` app.set('log4js', { appenders: { ruleFile: { type: 'dateFile', filename: 'logs/log4js', pattern: '-yyyy-MM-dd.log', alwaysIncludePattern: true, } }, categories: { default: { appenders: [ 'ruleFile' ], level: 'all' }, }, replaceConsole: true, pm2: true, pm2InstanceVar: 'INSTANCE_ID', }); ```