Merge branch 'master' of github.com:elastic/elasticsearch-js into fix/leakingTimesInTransport
This commit is contained in:
@ -62,19 +62,26 @@ Log.prototype.close = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Log.prototype.listenerCount = function (event) {
|
|
||||||
// node >= 3.0 supports EE#listenerCount()
|
|
||||||
if (EventEmitter.prototype.listenerCount) {
|
if (EventEmitter.prototype.listenerCount) {
|
||||||
return EventEmitter.prototype.listenerCount.call(this, event);
|
// If the event emitter implements it's own listenerCount method
|
||||||
|
// we don't need to (newer nodes do this).
|
||||||
|
Log.prototype.listenerCount = EventEmitter.prototype.listenerCount;
|
||||||
}
|
}
|
||||||
|
else if (EventEmitter.listenerCount) {
|
||||||
// compatability for node < 0.10
|
// some versions of node expose EventEmitter::listenerCount
|
||||||
if (EventEmitter.listenerCount) {
|
// which is more efficient the getting all listeners of a
|
||||||
|
// specific type
|
||||||
|
Log.prototype.listenerCount = function (event) {
|
||||||
return EventEmitter.listenerCount(this, event);
|
return EventEmitter.listenerCount(this, event);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// all other versions of node expose a #listeners() method, which returns
|
||||||
|
// and array we have to count
|
||||||
|
Log.prototype.listenerCount = function (event) {
|
||||||
return this.listeners(event).length;
|
return this.listeners(event).length;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Levels observed by the loggers, ordered by rank
|
* Levels observed by the loggers, ordered by rank
|
||||||
|
|||||||
Reference in New Issue
Block a user