@kofile/production-pino-log-formatter
v2.1.0
Published
[![NPM version](https://flat.badgen.net/npm/v/@kofile/production-pino-log-formatter)](https://www.npmjs.com/package/@kofile/production-pino-log-formatter) [![Build Status](https://flat.badgen.net/travis/kofile/production-pino-log-formatter)](https://travi
Downloads
18
Maintainers
Keywords
Readme
Production Pino Log Formatter
Transport for pino
Takes
{
"level": 30,
"time": 1531171074631,
"msg": "hello world",
"pid": 657,
"hostname": "Davids-MBP-3.fritz.box",
"v": 1,
"prop1": "hello",
"prop2": 42
}
and emits
2018-07-09T21:17:54Z [INFO] hello world, prop1={hello}, prop2={42}
Install
yarn add @kofile/production-pino-log-formatter
Usage
const pino = require("pino");
const { format } = require("@kofile/production-pino-log-formatter");
const logger = pino(format());
How
In addition to configuration options, Pino accepts a destination stream to emit
log entires to. This library provides a transform stream as the target which can
rewrite the log entries before they're emitted to stdout
.
Note that this is an in-process transport.
Ideally, a transport should consume logs in a separate process to the application. Using transports in the same process causes unnecessary load and slows down Node's single threaded event loop.
This approach is still likely faster than using @kofile/log, though I don't have benchmarks to support that assertion.
Notes
- No ANSI color codes. Ever.