Any stream with an on function will register for error
This commit is contained in:
parent
f299ac98f2
commit
e0e06d3af5
1 changed files with 5 additions and 3 deletions
|
@ -547,9 +547,6 @@ Logger.prototype.addStream = function addStream(s, defaultLevel) {
|
|||
if (!s.stream) {
|
||||
s.stream = fs.createWriteStream(s.path,
|
||||
{flags: 'a', encoding: 'utf8'});
|
||||
s.stream.on('error', function (err) {
|
||||
self.emit('error', err, s);
|
||||
});
|
||||
if (!s.closeOnExit) {
|
||||
s.closeOnExit = true;
|
||||
}
|
||||
|
@ -579,6 +576,11 @@ Logger.prototype.addStream = function addStream(s, defaultLevel) {
|
|||
throw new TypeError('unknown stream type "' + s.type + '"');
|
||||
}
|
||||
|
||||
if(typeof s.stream.on === 'function') {
|
||||
s.stream.on('error', function (err) {
|
||||
self.emit('error', err, s);
|
||||
});
|
||||
}
|
||||
self.streams.push(s);
|
||||
delete self.haveNonRawStreams; // reset
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue