From 40877305412966dc8fd328bfc21a4735328ee078 Mon Sep 17 00:00:00 2001 From: "runlevel3@goedel" Date: Tue, 27 Sep 2016 12:42:31 +0200 Subject: [PATCH] Patch: On reopenFileStream reopen children's streams as well --- lib/bunyan.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/bunyan.js b/lib/bunyan.js index 0817054e..57f28bbd 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -355,6 +355,8 @@ function Logger(options, _childOptions, _childSimple) { return new Logger(options, _childOptions); } + this.childs= []; + // Input arg validation. var parent; if (_childOptions !== undefined) { @@ -389,6 +391,8 @@ function Logger(options, _childOptions, _childSimple) { throw new TypeError('invalid options.serializers: must be an object') } + if ( parent ) parent.childs.push(this); + EventEmitter.call(this); // Fast path for simple child creation. @@ -724,6 +728,10 @@ Logger.prototype.reopenFileStreams = function () { }); } }); + // reopen childs' streams as well + self.childs.forEach(function( child ) { + child.reopenFileStreams(); + }); };