koa-logger
Development style logger middleware for koa. Compatible with request-received.
Notice: koa-logger@2
supports koa@2
; if you want to use this module with koa@1
, please use koa-logger@1
.
<-- GET /
--> GET / 200 835ms 746b
<-- GET /
--> GET / 200 960ms 1.9kb
<-- GET /users
--> GET /users 200 357ms 922b
<-- GET /users?page=2
--> GET /users?page=2 200 466ms 4.66kb
Installation
$ npm install koa-logger
Example
const logger = const Koa = const app = app
Notes
Recommended that you .use()
this middleware near the top
to "wrap" all subsequent middleware.
Use Custom Transporter
const logger = const Koa = const app = app
or
app
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]
License
MIT