Repository: pinojs/pino (js)

Issue:
Child Serializer overwriting parent
Child serializers are overwriting the parent's serializers.

```
var pino = require('pino')

var logger = pino()

var customSerializers = {
  test: function () {
    return 'this is my serializer'
  }
}

var child1 = logger.child({ child: '1', serializers: customSerializers })

var child2 = logger.child({ child: '2' })

logger.info({test: 'should show up'})

child1.info({test: 'should not show up'})

child2.info({test: 'should show up'})
```

results in: 
```
{"pid":13537,"hostname":"MacBook-Pro.local","level":30,"time":1487674087287,"test":"this is my serializer","v":1}
{"pid":13537,"hostname":"MacBook-Pro.local","level":30,"time":1487674087289,"test":"this is my serializer","child":"1","v":1}
{"pid":13537,"hostname":"MacBook-Pro.local","level":30,"time":1487674087289,"test":"this is my serializer","child":"2","v":1}
```

I will submit a PR for fix

Pull request description:
child serializers should not overwrite parents
fixes #195 

Patch:
diff --git a/pino.js b/pino.js
index e010dab..d42cb41 100644
--- a/pino.js
+++ b/pino.js
@@ -215,7 +215,7 @@ Pino.prototype.child = function child (bindings) {
   var opts = {
     level: bindings.level || this.level,
     levelVal: levels.isStandardLevelVal(this.levelVal) ? undefined : this.levelVal,
-    serializers: bindings.hasOwnProperty('serializers') ? Object.assign(this.serializers, bindings.serializers) : this.serializers,
+    serializers: bindings.hasOwnProperty('serializers') ? Object.assign({}, this.serializers, bindings.serializers) : this.serializers,
     stringify: this.stringify,
     end: this.end,
     name: this.name,


Test patch:
diff --git a/test/serializers.test.js b/test/serializers.test.js
index 58ab8a9..a87a836 100644
--- a/test/serializers.test.js
+++ b/test/serializers.test.js
@@ -17,8 +17,8 @@ test('child does not override parent serializers', function (t) {
   var parent = pino({ serializers: parentSerializers })
   var child = parent.child({ serializers: childSerializers })
 
-  t.deepEqual(parent.serializers, parentSerializers)
-  t.deepEqual(child.serializers, childSerializers)
+  t.equal(parent.serializers.test(), 'parent')
+  t.equal(child.serializers.test(), 'child')
 })
 
 test('children inherit parent serializers', function (t) {
@@ -27,7 +27,7 @@ test('children inherit parent serializers', function (t) {
   var parent = pino({ serializers: parentSerializers })
   var child = parent.child({a: 'property'})
 
-  t.deepEqual(child.serializers, parentSerializers)
+  t.equal(child.serializers.test(), 'parent')
 })
 
 test('children serializers get called', function (t) {
@@ -70,7 +70,7 @@ test('children serializers get called when inherited from parent', function (t)
 })
 
 test('non overriden serializers are available in the children', function (t) {
-  t.plan(3)
+  t.plan(4)
   var pSerializers = {
     onlyParent: function () { return 'parent' },
     shared: function () { return 'parent' }
@@ -87,4 +87,5 @@ test('non overriden serializers are available in the children', function (t) {
   t.equal(child.serializers.shared(), 'child')
   t.equal(child.serializers.onlyParent(), 'parent')
   t.equal(child.serializers.onlyChild(), 'child')
+  t.notOk(parent.serializers.onlyChild)
 })