koa-logger4miwoy
v1.0.0
Published
Logging middleware for koa
Downloads
35
Readme
koa-logger
Development style logger middleware for koa.
Notice: koa-logger@2
supports koa@2
; if you want to use this module with koa@1
, please use koa-logger@1
.
[2017-03-21T07:07:27.661Z] <-- GET /
[2017-03-21T07:07:27.661Z] --> GET / 200 835ms 746b
[2017-03-21T07:07:27.661Z] <-- GET /
[2017-03-21T07:07:27.661Z] --> GET / 200 960ms 1.9kb
[2017-03-21T07:07:27.661Z] <-- GET /users
[2017-03-21T07:07:27.661Z] --> GET /users 200 357ms 922b
[2017-03-21T07:07:27.661Z] <-- GET /users?page=2
[2017-03-21T07:07:27.661Z] --> GET /users?page=2 200 466ms 4.66kb
Installation
$ npm install koa-logger
Example
const logger = require('koa-logger')
const Koa = require('koa')
const app = new Koa()
app.use(logger())
Notes
Recommended that you .use()
this middleware near the top
to "wrap" all subsequent middleware.
License
MIT