pino
10.4.0 · 2 Oct 2026MIT76M / weekRepositoryHomepagenpmAtom feed
7.11.0 is the newest release of 7.x.
In short
1 removed1 deprecated7 new5 fixed21 changed1 internal
- removed
Removed deprecated options in pino.child()
- deprecated
Deprecate the prettyPrint option
Release note
New Features
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: 'pino-pretty'
}, {
level: 'trace',
target: 'pino/file',
options: { destination: '/path/to/store/logs' }
}]
})
pino(transports)Transports may alternatively be arranged in a pipeline:
const logger = pino({
transport: {
pipeline: [{
target: './my-transform.js'
}, {
// Use target: 'pino/file' to write to stdout
// without any change.
target: 'pino-pretty'
}]
}
})
logger.info('hello world')For more on transports, how they work, and how to create them see the Transports documentation.
The internal implementation is based on thread-stream ⇗.
`pino.multistream()``
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.
Added TypeScript types
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");Updated sonic-boom
sonic-boom, our fs.createWriteStream() replacement has become safer to use in v2.x.
A few selected changes:
Atomic sync writes #102
Add retryEAGAIN callback function #95
Fix writing deadlock #104
flush() with no buffered data should work #105
Solved "exit" problem for sync: false destinations and transports
Thanks to the addition of WeakRef and FinalizationRegistry to JavaScript (available in Node.js v14+) we can automatically flush asynchronous streams when the processes exits without leaking memory.
Check out github.com/mcollina/on-exit-leak-free.
Breaking Changes
Deprecation of prettyPrint option
The prettyPrint option has been deprecated in favor of the new transport system.
Dropped Node.js v10.x
Node.js v10 went out of LTS/Maintenance in April 2021.
We are dropping support.
Apply err serializer everywhere
We 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.
Removal of extreme mode
Extreme mode has been deprecated in previous release cycle and it has now been removed.
Pull Requests
Removed all outstanding deprecations
Pino.transport()
Add pino.multistream
Add TS types
Apply err serializer everywhere.
Make the nestedKey only take effect in the serialized object and fix error detection and serialization #885
Transport async function example
Make sure that the main thread stays alive to process stdout.
Completely removed extreme mode
Make ThreadStream sync: false (the default)
Automatically flush the logs on exit in Node v14+
Add overload to handle unknown returned by TS-4.4 for errors be default
pino-pretty transport convertion
Package manager CI action
- deprecated
Deprecate the prettyPrint option
Add transports constructor option
Use fastify-warning in v7
Document pino.transport() async startup
Improve TS types
- removed
Removed deprecated options in pino.child()
Update the
options.leveldocumentation of the child loggerMake pino.final sync flushes when no handler provided
Removed multistream prettyPrint deprecation and clean up docs
dep: Removes fast-safe-stringify dep
Remove whitespace from markdown files
Restore automerge
Removed coveralls, removed TS badge
Flush thread-stream missing callback
Transport pipeline
fix missing end quote in docs/transports.md
Correctly select the caller file when using the transport option