Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino

Package Overview
Dependencies
Maintainers
4
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino - npm Package Compare versions

Comparing version 8.9.0 to 8.10.0

1

docs/api.md

@@ -1203,2 +1203,3 @@ # API

* `pipeline`: May be specified instead of `target`. Must be an array of transport configurations. Transport configurations include the aforementioned `options` and `target` options. All intermediate steps in the pipeline _must_ be `Transform` streams and not `Writable`.
* `dedupe`: See [pino.multistream options](#pino-multistream)

@@ -1205,0 +1206,0 @@ <a id="pino-multistream"></a>

@@ -114,2 +114,15 @@ # Transports

It is also possible to use the `dedupe` option to send logs only to the stream with the higher level.
```js
const pino = require('pino')
const transport = pino.transport({
targets: [
{ target: '/absolute/path/to/my-transport.mjs', level: 'error' },
{ target: 'some-file-transport', options: { destination: '/dev/null' }
],
dedupe: true
})
pino(transport)
```
For more details on `pino.transport` see the [API docs for `pino.transport`][pino-transport].

@@ -116,0 +129,0 @@

2

lib/meta.js
'use strict'
module.exports = { version: '8.9.0' }
module.exports = { version: '8.10.0' }

@@ -74,3 +74,3 @@ 'use strict'

function transport (fullOptions) {
const { pipeline, targets, levels, options = {}, worker = {}, caller = getCallers() } = fullOptions
const { pipeline, targets, levels, dedupe, options = {}, worker = {}, caller = getCallers() } = fullOptions

@@ -111,2 +111,6 @@ // Backwards compatibility

if (dedupe) {
options.dedupe = dedupe
}
return buildStream(fixTarget(target), options, worker)

@@ -113,0 +117,0 @@

@@ -12,3 +12,3 @@ 'use strict'

module.exports = async function ({ targets, levels }) {
module.exports = async function ({ targets, levels, dedupe }) {
targets = await Promise.all(targets.map(async (t) => {

@@ -42,3 +42,3 @@ const fn = await loadTransportStreamBuilder(t.target)

function process (stream) {
const multi = pino.multistream(targets, { levels })
const multi = pino.multistream(targets, { levels, dedupe })
// TODO manage backpressure

@@ -45,0 +45,0 @@ stream.on('data', function (chunk) {

{
"name": "pino",
"version": "8.9.0",
"version": "8.10.0",
"description": "super fast, all natural json logger",

@@ -5,0 +5,0 @@ "main": "pino.js",

@@ -265,2 +265,3 @@ // Type definitions for pino 7.0

levels?: Record<string, number>
dedupe?: boolean
}

@@ -267,0 +268,0 @@

@@ -204,2 +204,40 @@ 'use strict'

test('pino.transport with two files and dedupe', async ({ same, teardown }) => {
const dest1 = file()
const dest2 = file()
const transport = pino.transport({
dedupe: true,
targets: [{
level: 'info',
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
options: { destination: dest1 }
}, {
level: 'error',
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
options: { destination: dest2 }
}]
})
teardown(transport.end.bind(transport))
const instance = pino(transport)
instance.info('hello')
instance.error('world')
await Promise.all([watchFileCreated(dest1), watchFileCreated(dest2)])
const result1 = JSON.parse(await readFile(dest1))
delete result1.time
same(result1, {
pid,
hostname,
level: 30,
msg: 'hello'
})
const result2 = JSON.parse(await readFile(dest2))
delete result2.time
same(result2, {
pid,
hostname,
level: 50,
msg: 'world'
})
})
test('pino.transport with an array including a pino-pretty destination', async ({ same, match, teardown }) => {

@@ -206,0 +244,0 @@ const dest1 = file()

@@ -123,1 +123,7 @@ import { pino } from '../../pino'

})
// Dedupe
pino.transport({
targets: [],
dedupe: true,
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc