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) {
|
if (!s.stream) {
|
||||||
s.stream = fs.createWriteStream(s.path,
|
s.stream = fs.createWriteStream(s.path,
|
||||||
{flags: 'a', encoding: 'utf8'});
|
{flags: 'a', encoding: 'utf8'});
|
||||||
s.stream.on('error', function (err) {
|
|
||||||
self.emit('error', err, s);
|
|
||||||
});
|
|
||||||
if (!s.closeOnExit) {
|
if (!s.closeOnExit) {
|
||||||
s.closeOnExit = true;
|
s.closeOnExit = true;
|
||||||
}
|
}
|
||||||
|
@ -579,6 +576,11 @@ Logger.prototype.addStream = function addStream(s, defaultLevel) {
|
||||||
throw new TypeError('unknown stream type "' + s.type + '"');
|
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);
|
self.streams.push(s);
|
||||||
delete self.haveNonRawStreams; // reset
|
delete self.haveNonRawStreams; // reset
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue