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

pino

Package Overview
Dependencies
Maintainers
2
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 1.0.5 to 1.1.0

2

package.json
{
"name": "pino",
"version": "1.0.5",
"version": "1.1.0",
"description": "fast and simple logger",

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

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

function child (bindings) {
if (!opts) {
if (!bindings) {
throw new Error('missing bindings for child logger')

@@ -213,2 +213,10 @@ }

function asErrValue (err) {
return {
type: err.constructor.name,
message: err.message,
stack: err.stack
}
}
module.exports = pino

@@ -218,3 +226,4 @@

req: asReqValue,
res: asResValue
res: asResValue,
err: asErrValue
}

@@ -138,2 +138,3 @@ # pino

* <a href="#resSerializer"><code>pino.stdSerializers.<b>res</b></code></a>
* <a href="#errSerializer"><code>pino.stdSerializers.<b>err</b></code></a>

@@ -328,2 +329,20 @@ <a name="constructor"></a>

<a name="errSerializer"></a>
### pino.stdSerializers.err
Serializes an `Error` object if passed in as an property.
```js
{
"pid": 40510,
"hostname": "MBP-di-Matteo",
"level": 50,
"msg": "an error",
"time": 1459433282301,
"v": 1,
"type": "Error",
"stack": "Error: an error\n at Object.<anonymous> (/Users/matteo/Repositories/pino/example.js:16:7)\n at Module._compile (module.js:435:26)\n at Object.Module._extensions..js (module.js:442:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:313:12)\n at Function.Module.runMain (module.js:467:10)\n at startup (node.js:136:18)\n at node.js:963:3"
}
```
<a name="rotate"></a>

@@ -391,2 +410,9 @@ ## How do I rotate log files

### v1.1.0
* [#18](https://github.com/mcollina/pino/pull/18) Added the error
serializer
* [#17](https://github.com/mcollina/pino/pull/17) throw when creating a
child logger without bindings
### v1.0.5

@@ -393,0 +419,0 @@

@@ -110,2 +110,30 @@ 'use strict'

test('passing error with a serializer at level ' + name, function (t) {
t.plan(2)
var err = new Error('myerror')
var instance = pino({
serializers: {
err: pino.stdSerializers.err
}
}, sink(function (chunk, enc, cb) {
t.ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()')
delete chunk.time
t.deepEqual(chunk, {
pid: pid,
hostname: hostname,
level: level,
err: {
type: 'Error',
message: err.message,
stack: err.stack
},
v: 1
})
cb()
}))
instance.level = name
instance[name]({ err: err })
})
test('child logger for level ' + name, function (t) {

@@ -484,1 +512,15 @@ t.plan(2)

})
test('throw if creating child without bindings', function (t) {
t.plan(1)
var instance = pino(
sink(function (chunk, enc, cb) {
t.ok(Date.parse(chunk.time) <= new Date(), 'time is greater than Date.now()')
t.end()
}))
t.throws(function () {
instance.child()
})
})
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