2016-07-25 19:41:47 +03:00
![banner ](pino-banner.png )
2019-02-25 17:10:41 +03:00
# pino [![Build Status](https://travis-ci.org/pinojs/pino.svg?branch=master)](https://travis-ci.org/pinojs/pino) [![Coverage Status](https://coveralls.io/repos/github/pinojs/pino/badge.svg?branch=master)](https://coveralls.io/github/pinojs/pino?branch=master) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![TypeScript definitions on DefinitelyTyped](https://definitelytyped.org/badges/standard.svg)](https://definitelytyped.org)
2016-02-20 02:09:58 +03:00
2018-10-03 14:28:39 +03:00
[Very low overhead ](#low-overhead ) Node.js logger, inspired by Bunyan.
2018-07-10 14:09:50 +03:00
## Documentation
* [Benchmarks ⇗ ](/docs/benchmarks.md )
* [API ⇗ ](/docs/api.md )
* [Browser API ⇗ ](/docs/browser.md )
* [Redaction ⇗ ](/docs/redaction.md )
* [Child Loggers ⇗ ](/docs/child-loggers.md )
* [Transports ⇗ ](/docs/transports.md )
* [Web Frameworks ⇗ ](/docs/web.md )
* [Pretty Printing ⇗ ](/docs/pretty.md )
* [Extreme Mode ⇗ ](/docs/extreme.md )
* [Ecosystem ⇗ ](/docs/ecosystem.md )
2018-07-14 19:36:40 +03:00
* [Legacy ](/docs/legacy.md )
2018-07-10 14:09:50 +03:00
* [Help ⇗ ](/docs/help.md )
2016-02-21 14:44:00 +03:00
## Install
```
2018-07-14 18:14:39 +03:00
$ npm install pino
2016-02-21 14:44:00 +03:00
```
## Usage
```js
2018-07-10 14:09:50 +03:00
const logger = require('pino')()
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
logger.info('hello world')
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
const child = logger.child({ a: 'property' })
child.info('hello child!')
2016-02-21 14:44:00 +03:00
```
2016-03-05 19:42:18 +03:00
This produces:
```
2018-07-10 14:09:50 +03:00
{"level":30,"time":1531171074631,"msg":"hello world","pid":657,"hostname":"Davids-MBP-3.fritz.box","v":1}
{"level":30,"time":1531171082399,"msg":"hello child!","pid":657,"hostname":"Davids-MBP-3.fritz.box","a":"property","v":1}
2017-07-06 20:59:12 +03:00
```
2018-10-19 17:45:08 +03:00
For using Pino with a web framework see:
2017-07-07 20:13:16 +03:00
2018-07-10 14:09:50 +03:00
* [Pino with Fastify ](docs/web.md#fastify )
* [Pino with Express ](docs/web.md#express )
* [Pino with Hapi ](docs/web.md#hapi )
* [Pino with Restify ](docs/web.md#restify )
* [Pino with Koa ](docs/web.md#koa )
* [Pino with Node core `http` ](docs/web.md#http )
2017-07-06 20:59:12 +03:00
2017-03-21 20:33:06 +03:00
2018-07-10 14:09:50 +03:00
< a name = "essentials" > < / a >
## Essentials
2017-03-21 20:33:06 +03:00
2018-07-10 14:09:50 +03:00
### Development Formatting
2017-03-21 20:33:06 +03:00
2018-10-19 17:45:08 +03:00
The [`pino-pretty` ](https://github.com/pinojs/pino-pretty ) module can be used to
2018-07-10 14:09:50 +03:00
format logs during development:
2017-03-21 20:33:06 +03:00
2018-07-10 14:09:50 +03:00
![pretty demo ](pretty-demo.png )
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
### Transports & Log Processing
2016-04-01 18:26:11 +03:00
2018-10-19 17:45:08 +03:00
Due to Node's single-threaded event-loop, it's highly recommended that sending,
alert triggering, reformatting and all forms of log processing
is conducted in a separate process. In Pino parlance we call all log processors
2018-07-10 14:09:50 +03:00
"transports", and recommend that the transports be run as separate
2018-10-19 17:45:08 +03:00
processes, piping the stdout of the application to the stdin of the transport.
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
For more details see our [Transports⇗ ](docs/transports.md ) document.
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
### Low overhead
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
Using minimum resources for logging is very important. Log messages
tend to get added over time and this can lead to a throttling effect
on applications – such as reduced requests per second.
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
In many cases, Pino is over 5x faster than alternatives.
2016-04-01 18:26:11 +03:00
2018-07-10 14:09:50 +03:00
See the [Benchmarks ](docs/benchmarks.md ) document for comparisons.
2016-04-01 18:26:11 +03:00
2016-04-05 19:35:51 +03:00
< a name = "team" > < / a >
## The Team
### Matteo Collina
2016-10-25 10:26:50 +03:00
< https: / / github . com / pinojs >
2016-04-05 19:35:51 +03:00
< https: / / www . npmjs . com / ~ matteo . collina >
< https: / / twitter . com / matteocollina >
### David Mark Clements
< https: / / github . com / davidmarkclements >
< https: / / www . npmjs . com / ~ davidmarkclements >
< https: / / twitter . com / davidmarkclem >
2016-03-30 16:03:48 +03:00
2016-09-13 20:10:04 +03:00
### James Sumners
< https: / / github . com / jsumners >
< https: / / www . npmjs . com / ~ jsumners >
< https: / / twitter . com / jsumners79 >
2017-01-10 14:48:36 +03:00
### Thomas Watson Steen
< https: / / github . com / watson >
< https: / / www . npmjs . com / ~ watson >
< https: / / twitter . com / wa7son >
2018-07-14 21:45:27 +03:00
## Communication
2016-06-08 13:01:13 +03:00
### Chat on Gitter
2016-10-25 10:26:50 +03:00
< https: / / gitter . im / pinojs / pino >
2016-06-08 13:01:13 +03:00
2017-06-06 15:15:43 +03:00
### Chat on IRC
2017-09-22 18:19:02 +03:00
You'll find an active group of Pino users in the #pinojs channel on Freenode, including some of the contributors to this project.
2017-06-06 15:15:43 +03:00
2016-11-13 13:21:05 +03:00
## Contributing
Pino is an **OPEN Open Source Project** . This means that:
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the [CONTRIBUTING.md ](https://github.com/pinojs/pino/blob/master/CONTRIBUTING.md ) file for more details.
2016-03-07 14:41:53 +03:00
< a name = "acknowledgements" > < / a >
## Acknowledgements
This project was kindly sponsored by [nearForm ](http://nearform.com ).
2018-02-13 23:53:52 +03:00
Logo and identity designed by Cosmic Fox Design: https://www.behance.net/cosmicfox.
2016-07-25 19:57:16 +03:00
2016-02-21 14:44:00 +03:00
## License
2016-06-08 13:01:13 +03:00
Licensed under [MIT ](./LICENSE ).
2016-06-21 11:05:47 +03:00
[elasticsearch]: https://www.elastic.co/products/elasticsearch
[kibana]: https://www.elastic.co/products/kibana