@kofile/production-pino-log-formatter
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Production Pino Log Formatter

NPM version Build Status semantic-release

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.

Pino discourages this:

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @kofile/production-pino-log-formatter

Weekly Downloads

1

Version

2.1.0

License

MIT

Unpacked Size

6.39 kB

Total Files

4

Last publish

Collaborators

  • bwgovos
  • juandagovos
  • matt_huntsberry
  • afine_govos
  • bthomas_govos
  • chrisburch-govos
  • rarzate
  • narekdaghlaryan
  • daniltarasov
  • kofilesystems
  • neezer
  • scottkof
  • jbalfantz
  • ngraves
  • arturhovhannisyan1994volo
  • rachel-ftw
  • warrenyoungkofile