koa-logger
官方仓库
https://github.com/koajs/logger
官方npm地址
依赖包地址
https://www.npmjs.com/package/koa-logger

在线运行地址
https://npm.runkit.com/koa-logger
基础介绍
Development style logger middleware for koa. Compatible with request-received.
基础安装
npm install koa-logger --save # npm
yarn add koa-logger # Yarn
基础使用
Recommended that you .use() this middleware near the top to "wrap" all subsequent middleware.
const logger = require('koa-logger')
const Koa = require('koa')
const app = new Koa()
app.use(logger((str, args) => {
// redirect koa logger to other output pipe
// default is process.stdout(by console.log function)
}))
or
app.use(logger({
transporter: (str, args) => {
// ...
}
}))
Param str is output string with ANSI Color, and you can get pure text with other modules like strip-ansi
Param args is a array by [format, method, url, status, time, length]
koa-logger
官方仓库
https://github.com/koajs/logger
官方
npm地址https://www.npmjs.com/package/koa-logger
https://npm.runkit.com/koa-logger
基础介绍
Development style logger middleware for koa. Compatible with request-received.
基础安装
基础使用
Recommended that you .use() this middleware near the top to "wrap" all subsequent middleware.
Param str is output string with ANSI Color, and you can get pure text with other modules like strip-ansi
Param args is a array by [format, method, url, status, time, length]