Releases: pinojs/pino
v7.1.0
What's Changed
- Fix max-depth using safe-stable-stringify by @sameer-coder in #1169
- Update help.md (resolves #1188) by @jitterjuice1 in #1190
- Update api.md (resolves #1187) by @choinker in #1192
- Fixes issue with nested keys by @sameer-coder in #1198
- Improve docs and deprecation about prettyPrint by @mcollina in #1203
- Removed console.log() from transport doc by @mcollina in #1204
- bumped thread-stream to v0.12.0 by @mcollina in #1205
- Deprecation warning for pino.final() in Node v14+ by @sameer-coder in #1199
- build(deps): bump pino-abstract-transport from 0.4.0 to 0.5.0 by @dependabot in #1207
New Contributors
- @sameer-coder made their first contribution in #1169
- @jitterjuice1 made their first contribution in #1190
- @choinker made their first contribution in #1192
Full Changelog: v7.0.5...v7.1.0
v7.0.5
v7.0.4
v7.0.3
What's Changed
- build(deps): bump actions/checkout from 2.3.4 to 2.3.5 by @dependabot in #1170
- doc/transport: fix export typo by @glensc in #1173
- Fixes #1167 (dedupe should write to all streams matching the target level) by @frzsombor in #1172
- Bring the asynchronous logging doc up to v7 by @mcollina in #1171
New Contributors
- @frzsombor made their first contribution in #1172
Full Changelog: v7.0.2...v7.0.3
v7.0.2
What's Changed
- build(deps-dev): update pino-pretty requirement from ^v7.0.1 to ^v7.1.0 by @dependabot in #1155
- Fix types for
pino.multistream
by @clemyan in #1152 - fix(docs/transports): #pino/file has been renamed to pino/file by @pan93412 in #1159
- build(deps-dev): bump split2 from 3.2.2 to 4.0.0 by @dependabot in #1163
- fix formatters when used along transport by @TinOo512 in #1162
- Add transport option param to types by @kibertoad in #1156
New Contributors
- @clemyan made their first contribution in #1152
- @pan93412 made their first contribution in #1159
- @TinOo512 made their first contribution in #1162
Full Changelog: v7.0.1...v7.0.2
v7.0.1
Updated install instructions
Full Changelog: v7.0.0...v7.0.1
v7.0.0
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 pinojs/sonic-boom#102
- Add retryEAGAIN callback function pinojs/sonic-boom#95
- Fix writing deadlock pinojs/sonic-boom#104
- flush() with no buffered data should work pinojs/sonic-boom#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 https://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 (#1057)
- pino.transport() (#1003)
- Add pino.multistream (#1004)
- Add TS types (#913)
- Apply err serializer everywhere. (#896)
- Make the nestedKey only take effect in the serialized object and fix error detection and serialization #885
- fix: transport async function example (#1071)
- refactor: update typings (#1073)
- Make sure that the main thread stays alive to process stdout. (#1075)
- Completely removed extreme mode by @mcollina in #1090
- Make ThreadStream sync: false (the default) by @mcollina in #1089
- Automatically flush the logs on exit in Node v14+ by @mcollina in #1091
- Add overload to handle unknown returned by TS-4.4 for errors be default by @kibertoad in #1116
- pino-pretty transport convertion by @mcollina in #1110
- Package manager CI action by @Eomm in #1113
- Deprecate the prettyPrint option by @mcollina in #1122
- add transports constructor option by @Eomm in #1111
- Use fastify-warning in v7 by @jsumners in #1093
- Document pino.transport() async startup by @mcollina in #1097
- Improve TS types by @kibertoad in #1099
- Removed deprecated options in pino.child() by @mcollina in #1124
- Update the
options.level
documentation of the child logger by @marcbachmann in #1125 - fix: make pino.final sync flushes when no handler provided (#1126) by @javiertury in #1127
- Removed multistream prettyPrint deprecation and clean up docs by @mcollina in #1123
- dep: removes fast-safe-stringify dep by @leorossi in #1129
- Remove whitespace from markdown files by @justinpage in #1131
- Restore automerge by @kibertoad in #1135
- Removed coveralls, removed TS badge by @mcollina in #1134
- fix: flush thread-stream missing callback by @climba03003 in #1137
-
- fix missing end quote in docs/transports.md by @xieyuheng in #1148
- Correctly select the caller file when using the transport option by @mcollina in #1147
v7.0.0-rc.9
What's Changed
- fix missing end quote in docs/transports.md by @xieyuheng in #1148
- Correctly select the caller file when using the transport option by @mcollina in #1147
New Contributors
- @xieyuheng made their first contribution in #1148
Full Changelog: v7.0.0-rc.8...v7.0.0-rc.9
v7.0.0-rc.8
What's Changed
- build(deps): bump actions/setup-node from 2.4.0 to 2.4.1 by @dependabot in #1141
- Transport pipeline by @mcollina in #1143
Full Changelog: v7.0.0-rc.7...v7.0.0-rc.8
v7.0.0-rc.7
What's Changed
Full Changelog: v7.0.0-rc.6...v7.0.0-rc.7