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 7.0.1 to 7.0.2

test/types/pino-multistream.test-d.ts

4

docs/transports.md

@@ -215,3 +215,3 @@ # Transports

const transport = pino.transport({
target: '#pino/file',
target: 'pino/file',
options: { destination: '/path/to/file' }

@@ -224,3 +224,3 @@ })

The difference between using the `#pino/file` transport builtin and using `pino.destination` is that `pino.destination` runs in the main thread, whereas `#pino/file` sets up `pino.destination` in a worker thread.
The difference between using the `pino/file` transport builtin and using `pino.destination` is that `pino.destination` runs in the main thread, whereas `pino/file` sets up `pino.destination` in a worker thread.

@@ -227,0 +227,0 @@ #### `pino-pretty`

@@ -405,6 +405,5 @@ 'use strict'

stream = opts
opts = null
opts = {}
} else if (opts.transport) {
stream = transport({ caller, ...opts.transport })
opts = null
}

@@ -411,0 +410,0 @@ opts = Object.assign({}, defaultOptions, opts)

{
"name": "pino",
"version": "7.0.1",
"version": "7.0.2",
"description": "super fast, all natural json logger",

@@ -70,3 +70,3 @@ "main": "pino.js",

"devDependencies": {
"@types/node": "^16.9.4",
"@types/node": "^16.11.0",
"airtap": "4.0.3",

@@ -88,3 +88,3 @@ "benchmark": "^2.1.4",

"loglevel": "^1.6.7",
"pino-pretty": "^v7.0.1",
"pino-pretty": "^v7.1.0",
"pre-commit": "^1.2.2",

@@ -94,3 +94,3 @@ "proxyquire": "^2.1.3",

"semver": "^7.0.0",
"split2": "^3.1.1",
"split2": "^4.0.0",
"steed": "^1.1.3",

@@ -101,5 +101,5 @@ "strip-ansi": "^6.0.0",

"through2": "^4.0.0",
"ts-node": "^10.2.1",
"ts-node": "^10.3.0",
"tsd": "^0.18.0",
"typescript": "^4.4.2",
"typescript": "^4.4.4",
"winston": "^3.3.3"

@@ -106,0 +106,0 @@ },

@@ -218,2 +218,6 @@ // Type definitions for pino 6.3

interface TransportPipelineOptions{
pipeline: TransportSingleOptions[]
}
interface TransportMultiOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions>{

@@ -236,4 +240,4 @@ targets: readonly TransportTargetOptions<TransportOptions>[]

interface StreamEntry {
stream: WriteStream
level: Level
stream: DestinationStream
level?: Level
}

@@ -246,3 +250,3 @@

minLevel: number,
streams: WriteStream[],
streams: ({ stream: DestinationStream, level: number, id: number })[],
clone(level: Level): MultiStreamRes,

@@ -252,3 +256,4 @@ }

function multistream(
streamsArray: StreamEntry[], opts: P.MultiStreamOptions
streamsArray: (DestinationStream | StreamEntry)[] | DestinationStream | StreamEntry,
opts?: P.MultiStreamOptions
): MultiStreamRes

@@ -294,2 +299,3 @@

interface LoggerOptions {
transport?: TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions
/**

@@ -296,0 +302,0 @@ * Avoid error causes by circular references in the object tree. Default: `true`.

'use strict'
/* eslint no-prototype-builtins: 0 */
const os = require('os')
const { hostname } = require('os')
const { join } = require('path')
const { readFile } = require('fs').promises
const { test } = require('tap')
const { sink, once } = require('./helper')
const { sink, once, watchFileCreated } = require('./helper')
const pino = require('../')

@@ -302,1 +305,34 @@

})
test('formatter with transport', async ({ match, equal }) => {
const destination = join(
os.tmpdir(),
'_' + Math.random().toString(36).substr(2, 9)
)
const logger = pino({
formatters: {
log (obj) {
equal(obj.hasOwnProperty('msg'), false)
return { hello: 'world', ...obj }
}
},
transport: {
targets: [
{
target: join(__dirname, 'fixtures', 'to-file-transport.js'),
options: { destination }
}
]
}
})
logger.info({ foo: 'bar', nested: { object: true } }, 'hello world')
await watchFileCreated(destination)
const result = JSON.parse(await readFile(destination))
delete result.time
match(result, {
hello: 'world',
foo: 'bar',
nested: { object: true }
})
})
import { pino } from '../../pino'
import { expectType } from "tsd";

@@ -10,2 +11,8 @@ // Single

expectType<pino.Logger>(pino({
transport: {
target: 'pino-pretty'
},
}))
// Multiple

@@ -26,2 +33,29 @@ const transports = pino.transport({targets: [

expectType<pino.Logger>(pino({
transport: {targets: [
{
level: 'info',
target: '#pino/pretty',
options: { some: 'options for', the: 'transport' }
},
{
level: 'trace',
target: '#pino/file',
options: { destination: './test.log' }
}
]},
}))
expectType<pino.Logger>(pino({
transport: {
pipeline: [{
target: './my-transform.js'
}, {
// Use target: 'pino/file' to write to stdout
// without any change.
target: 'pino-pretty'
}]
}
}))
type TransportConfig = {

@@ -28,0 +62,0 @@ id: string

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