Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinojs/express-pino-logger
🌲 an express middleware to log with pino
https://github.com/pinojs/express-pino-logger
Last synced: 11 days ago
JSON representation
🌲 an express middleware to log with pino
- Host: GitHub
- URL: https://github.com/pinojs/express-pino-logger
- Owner: pinojs
- License: mit
- Archived: true
- Created: 2016-03-31T09:45:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T12:41:35.000Z (almost 2 years ago)
- Last Synced: 2024-09-08T14:48:41.216Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 68.4 KB
- Stars: 199
- Watchers: 7
- Forks: 13
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - pinojs/express-pino-logger - 🌲 an express middleware to log with pino (JavaScript)
- awesome-express - express-pino-logger - Use the fast, low overhead Pino logger to log each request. (Middleware)
README
# express-pino-logger
This repo exists only to help people understand that [pino-http](https://github.com/pinojs/pino-http) works seamlessly with [express](http://npm.im/express). To our knowledge, `pino-http` is the [fastest express](#benchmarks) logger in town.
## Benchmarks
Benchmarks log each request/response pair while returning
`'hello world'`, using
[autocannon](https://github.com/mcollina/autocannon) with 100
connections and 10 pipelined requests (`autocannon -c 100 -p 10 http://localhost:3000`).* `express-bunyan-logger`: 2702 req/sec
* `express-winston`: 5953 req/sec
* `morgan`: 8570 req/sec
* `pino-http`: 9807 req/sec
* `pino-http` (extreme): 10407 req/sec
* `pino-http` (without express): 22240.73 req/seq
* `pino-http` (without express and extreme): 25536 req/secAll benchmarks where taken on a Macbook Pro 2013 (2.6GHZ i7, 16GB of RAM).
Whilst we're comparing `pino-http` against [morgan](http://npm.im/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`](https://github.com/expressjs/morgan/blob/5da5ff1f5446e3f3ff29d29a2d6582712612bf89/index.js#L383) 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 `pino-http` achieves higher throughput with JSON logging **and** arbitrary data, without using `eval`, serves to emphasise the high-speed capabilities of `pino-http`.
With `pino-http` you can have features, safety **and** speed.