Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch: On reopenFileStream reopen children's streams as well #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ function Logger(options, _childOptions, _childSimple) {
return new Logger(options, _childOptions);
}

this.childs= [];

// Input arg validation.
var parent;
if (_childOptions !== undefined) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -724,6 +728,10 @@ Logger.prototype.reopenFileStreams = function () {
});
}
});
// reopen childs' streams as well
self.childs.forEach(function( child ) {
child.reopenFileStreams();
});
};


Expand Down