🌲 super fast, all natural json logger
MIT License
Bot releases are hidden (Show)
Published by jsumners about 3 years ago
Published by mcollina about 3 years ago
Full Changelog: https://github.com/pinojs/pino/compare/v7.0.0-rc.2...v7.0.0-rc.3
Published by mcollina about 3 years ago
📚 PR:
Published by mcollina about 3 years ago
All v7.0.0 release notes are included.
pino.transport()
Create a a stream that routes logs to a worker thread that
wraps around a Pino Transport.
const pino = require('pino')
const transport = pino.transport({
target: 'some-transport',
options: { some: 'options for', the: 'transport' }
})
pino(transport)
Multiple transports may also be defined, and specific levels can be logged to each transport:
const pino = require('pino')
const transports = pino.transport({
targets: [{
level: 'info',
target: 'some-transport',
options: { some: 'options for', the: 'transport' }
}, {
level: 'trace',
target: '#pino/file',
options: { destination: '/path/to/store/logs' }
}]
})
pino(transports)
For more on transports, how they work, and how to create them see the Transports documentation
.
Transports
thread-stream
⇗
We have embedded a part of pino-multi-stream
into pino itself, so you would be able to write to multiple streams from the same pino instance:
var fs = require('fs')
var pino = require('pino')
var streams = [
{stream: fs.createWriteStream('/tmp/info.stream.out')},
{level: 'debug', stream: fs.createWriteStream('/tmp/debug.stream.out')},
{level: 'fatal', stream: fs.createWriteStream('/tmp/fatal.stream.out')}
]
var log = pino({
level: 'debug' // this MUST be set at the lowest level of all the destinations
}, pino.multistream(streams))
log.debug('this will be written to /tmp/debug.stream.out')
log.info('this will be written to /tmp/debug.stream.out and /tmp/info.stream.out')
log.fatal('this will be written to /tmp/debug.stream.out, /tmp/info.stream.out and /tmp/fatal.stream.out')
This differs from pino.transport()
as all the streams will be executed within the main thread, i.e. the one that created the pino instance.
Types have been added to the the project, so you can now use pino with TypeScript without downloading any additional types: you should remove @types/pino
from your project. The following typescript example would now work correctly:
import { pino } from "pino";
const log = pino();
log.info("hello world");
log.error("this is at error level");
log.info("the answer is %d", 42);
log.info({ obj: 42 }, "hello world");
log.info({ obj: 42, b: 2 }, "hello world");
log. info({ obj: { aa: "bbb" } }, "another");
Node.js v10 went out of LTS/Maintenance in April 2021.
We are dropping support.
err
serializer everywhereWe will start applying the err
serializer also to Error
objects passed in as first argument to log methods, e.g. log.info(new Error('kaboom'))
will pass through the serializer.
Published by mcollina about 3 years ago
📚 PR:
docs/lts.md
(#1069)Published by mcollina over 3 years ago
📚 PR:
.child()
call triggers level-change
event. (#1014)Published by mcollina over 3 years ago
📚 PR:
Published by jsumners over 3 years ago
Published by mcollina over 3 years ago
📚 PR:
Published by jsumners almost 4 years ago
var
with let
and const
#947 #950Published by mcollina almost 4 years ago
📚 PR:
Published by mcollina almost 4 years ago
📚 PR:
Published by mcollina almost 4 years ago
📚 PR:
Published by davidmarkclements about 4 years ago
Published by jsumners about 4 years ago
Published by mcollina about 4 years ago
📚 PR:
Published by mcollina about 4 years ago
📚 PR:
Published by jsumners about 4 years ago
originalMsg
feature #882Published by jsumners about 4 years ago
Published by mcollina over 4 years ago
📚 PR: