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 9.1.0 to 9.2.0

35

browser.js

@@ -114,3 +114,4 @@ 'use strict'

levels,
timestamp: getTimeFunction(opts)
timestamp: getTimeFunction(opts),
messageKey: opts.messageKey || 'msg'
}

@@ -198,3 +199,3 @@ logger.levels = getLevels(opts)

// required to actually initialize the logger functions for any given child
newLogger.level = this.level
newLogger.level = childOptions.level || this.level // allow level to be set by childOptions

@@ -307,7 +308,9 @@ return newLogger

if (opts.serialize && !opts.transmit) {
var argsIsSerialized = false
if (opts.serialize) {
applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize)
argsIsSerialized = true
}
if (opts.asObject || opts.formatters) {
write.call(proto, asObject(this, level, args, ts, opts.formatters))
write.call(proto, asObject(this, level, args, ts, opts))
} else write.apply(proto, args)

@@ -328,3 +331,3 @@

val: levelToValue(self._level, rootLogger)
}, args)
}, args, argsIsSerialized)
}

@@ -335,7 +338,7 @@ }

function asObject (logger, level, args, ts, formatters = {}) {
function asObject (logger, level, args, ts, opts) {
const {
level: levelFormatter,
log: logObjectFormatter = (obj) => obj
} = formatters
} = opts.formatters || {}
const argsCloned = args.slice()

@@ -364,3 +367,3 @@ let msg = argsCloned[0]

} else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned)
if (msg !== undefined) logObject.msg = msg
if (msg !== undefined) logObject[opts.messageKey] = msg

@@ -385,3 +388,3 @@ const formattedLogObject = logObjectFormatter(logObject)

function transmit (logger, opts, args) {
function transmit (logger, opts, args, argsIsSerialized = false) {
const send = opts.send

@@ -394,8 +397,10 @@ const ts = opts.ts

applySerializers(
args,
logger._serialize || Object.keys(logger.serializers),
logger.serializers,
logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize
)
if (!argsIsSerialized) {
applySerializers(
args,
logger._serialize || Object.keys(logger.serializers),
logger.serializers,
logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize
)
}

@@ -402,0 +407,0 @@ logger._logEvent.ts = ts

'use strict'
module.exports = { version: '9.1.0' }
module.exports = { version: '9.2.0' }

@@ -74,4 +74,8 @@ 'use strict'

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

@@ -78,0 +82,0 @@ const callers = typeof caller === 'string' ? [caller] : caller

{
"name": "pino",
"version": "9.1.0",
"version": "9.2.0",
"description": "super fast, all natural json logger",

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

@@ -31,3 +31,3 @@ // Project: https://github.com/pinojs/pino.git, http://getpino.io

type TimeFn = () => string;
type MixinFn = (mergeObject: object, level: number) => object;
type MixinFn<CustomLevels extends string = never> = (mergeObject: object, level: number, logger:pino.Logger<CustomLevels>) => object;
type MixinMergeStrategyFn = (mergeObject: object, mixinObject: object) => object;

@@ -377,3 +377,3 @@

*/
mixin?: MixinFn;
mixin?: MixinFn<CustomLevels>;

@@ -380,0 +380,0 @@ /**

@@ -17,2 +17,14 @@ 'use strict'

test('child can set level at creation time', ({ end, same, is }) => {
const instance = pino({
level: 'error',
browser: {}
})
const child = instance.child({}, { level: 'info' }) // first bindings, then options
same(child.level, 'info')
end()
})
test('changing child level does not affect parent', ({ end, same, is }) => {

@@ -19,0 +31,0 @@ const instance = pino({

@@ -168,3 +168,20 @@ 'use strict'

})
test('opts.browser.asObject uses opts.messageKey in logs', ({ end, ok, is }) => {
const messageKey = 'message'
const instance = require('../browser')({
messageKey,
browser: {
asObject: true,
write: function (o) {
is(o.level, 30)
is(o[messageKey], 'test')
ok(o.time)
}
}
})
instance.info('test')
end()
})
test('opts.browser.formatters (level) logs pino-like object to console', ({ end, ok, is }) => {

@@ -259,2 +276,24 @@ const info = console.info

test('opts.browser.serialize, opts.asObject and opts.browser.transmit only serializes log data once', ({ end, ok, is }) => {
const instance = require('../browser')({
serializers: {
extras (data) {
return { serializedExtras: data }
}
},
browser: {
serialize: ['extras'],
asObject: true,
transmit: {
send (level, o) {
is(o.messages[0].extras.serializedExtras, 'world')
}
}
}
})
instance.info({ extras: 'world' }, 'test')
end()
})
test('opts.browser.write func log single string', ({ end, ok, is }) => {

@@ -261,0 +300,0 @@ const instance = pino({

@@ -469,2 +469,22 @@ 'use strict'

test('sets worker data informing the transport that pino will send its config (frozen file)', ({ match, plan, teardown }) => {
plan(1)
const config = {
transport: {
target: join(__dirname, '..', 'fixtures', 'transport-worker-data.js'),
options: {}
}
}
Object.freeze(config)
Object.freeze(config.transport)
Object.freeze(config.transport.options)
const instance = pino(config)
const transport = instance[pino.symbols.streamSym]
teardown(transport.end.bind(transport))
transport.once('workerData', (workerData) => {
match(workerData.workerData, { pinoWillSendConfig: true })
})
instance.info('hello')
})
test('stdout in worker', async ({ not }) => {

@@ -471,0 +491,0 @@ let actual = ''

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