1、 安装
yarn add log4js -D
2、设置
const log4js = require('log4js')
3、实例
var log = log4js.getLogger();
// logger
app.use(async (ctx, next) => {
// const start = new Date()
await next()
// const ms = new Date() - start
// console.log(`${ctx.method} ${ctx.url} - ${ms}ms`)
log.level = "debug";
log.debug("Some debug messages");
})