pinojs/koa-pino-logger — an open-source project — sits at 102 GitHub stars. 🌲 pino logging koa middleware
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
To our knowledge, koa-pino-logger is the fastest JSON koa logger in town.
Benchmarks
Installation
Usage
API
Acknowledgements
License
Benchmarks
Benchmarks log each request/response pair while returning
'hello world', using
autocannon with 100
connections and pipelining set to 1 (koa can't handle pipelining): autocannon -c 100 -p 1 http://localhost:3000.
koa-bunyan-logger: 5844 req/sec
koa-logger: 9401 req/sec
koa-morgan: 10881 req/sec
koa-pino-logger: 10534 req/sec
koa-pino-logger (extreme): 11112 req/sec
koa w/out logger: 14518 req/sec
All benchmarks where taken on a Macbook Pro 2013 (2.6GHZ i7, 16GB of RAM).
Benchmarking against koa-logger is an apples vs oranges situation. koa-logger is for development logging, and has extremely simple (non-JSON) output. Still, koa-pino-logger is faster so... why not.
Additionally, whilst we're comparing koa-pino-logger against koa-morgan, this isn't really a fair contest.
Morgan doesn't support logging arbitrary data, nor does it output JSON. Further Morgan uses a form of eval to achieve high speed logging. Whilst probably safe, using eval at all tends to cause concern, particular when it comes to server-side JavaScript.
The fact that koa-pino-logger achieves similar throughput with JSON logging and arbitrary data, without using eval, serves to emphasise the high-speed capabilities of koa-pino-logger.
With koa-pino-logger you can have features, safety and speed.
Install
npm i koa-pino-logger
Example
Request logging
'use strict'
var koa = require('koa')
var logger = require('koa-pino-logger')
var app = new Koa()
app.use(logger())
app.use((ctx) => {
ctx.log.info('something else')
ctx.body = 'hello world'
})
app.listen(3000)
'use strict'
var koa = require('koa')
var logger = require('koa-pino-logger')
var app = new Koa()
app.silent = true // disable console.errors
app.use(logger())
app.use((ctx) => {
ctx.body = 'hello world'
throw Error('bang!')
})
app.listen(3000)
$ node error-example.js | pino
$ node error-example.js | pino
[2016-04-21T13:05:10.298Z] ERROR (20482 on MacBook-Pro-4.local): request errored
res: {
"statusCode": 200,
"header": null
}
err: {
"type": "Error",
"message": "bang!",
"stack": "Error: bang!\n at Error (native)\n at /Users/davidclements/z/nearForm/koa-pino-logger/error-example.js:12:9\n at dispatch (/Users/davidclements/z/nearForm/koa-pino-logger/node_modules/koa/node_modules/koa-compose/index.js:43:32)\n at next (/Users/davidclements/z/nearForm/koa-pino-logger/node_modules/koa/node_modules/koa-compose/index.js:44:18)\n at pino (/Users/davidclements/z/nearForm/koa-pino-logger/logger.js:13:12)\n at dispatch (/Users/davidclements/z/nearForm/koa-pino-logger/node_modules/koa/node_modules/koa-compose/index.js:43:32)\n at /Users/davidclements/z/nearForm/koa-pino-logger/node_modules/koa/node_modules/koa-compose/index.js:36:12\n at Server.<anonymous> (/Users/davidclements/z/nearForm/koa-pino-logger/node_modules/koa/lib/application.js:135:7)\n at emitTwo (events.js:100:13)\n at Server.emit (events.js:185:7)"
}
req: {
"id": 1,
"method": "GET",
"url": "/",
"headers": {
"host": "localhost:3000",
"user-agent": "curl/7.43.0",
"accept": "*/*"
},
"remoteAddress": "::1",
"remotePort": 50934
}
[2016-04-21T13:05:10.305Z] INFO (20482 on MacBook-Pro-4.local): request completed
res: {
"statusCode": 500,
"header": "HTTP/1.1 500 Internal Server Error\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 21\r\nDate: Thu, 21 Apr 2016 13:05:10 GMT\r\nConnection: keep-alive\r\n\r\n"
}
responseTime: 11
req: {
"id": 1,
"method": "GET",
"url": "/",
"headers": {
"host": "localhost:3000",
"user-agent": "curl/7.43.0",
"accept": "*/*"
},
"remoteAddress": "::1",
"remotePort": 50934
}
API
koa-pino-logger has the same options as
pino
koa-pino-logger will log when a request finishes or errors.
Along with automated request logging, the pino logger facilitates manual logging
by adding the pino logger instance to the the context, request, response, req and res objects:
Does pinojs/koa-pino-logger have a project website?
No homepage URL was recorded for pinojs/koa-pino-logger in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does pinojs/koa-pino-logger have any tags?
TopGit's last sync did not record any GitHub topics for pinojs/koa-pino-logger. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on pinojs/koa-pino-logger?
The most recent commit recorded on pinojs/koa-pino-logger was 2 months ago, based on the GitHub push timestamp. The repository has 26 forks — one of the better signals of community interest.
How many stars does pinojs/koa-pino-logger have?
pinojs/koa-pino-logger has 102 GitHub stars — refresh the page for the live number, or check github.com/pinojs/koa-pino-logger. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is pinojs/koa-pino-logger written in?
pinojs/koa-pino-logger is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
What license does pinojs/koa-pino-logger use?
pinojs/koa-pino-logger is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about pinojs/koa-pino-logger?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/pinojs/koa-pino-logger is the definitive source.
Read full README in the tab above.
Curious whether koa-pino-logger is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about koa-pino-logger.