Improves simulcast logging.

This commit is contained in:
George Politis 2014-11-10 11:51:27 +01:00
parent 4a062e5f5c
commit feffcd18de
1 changed files with 11 additions and 4 deletions

View File

@ -6,7 +6,7 @@
* @constructor * @constructor
*/ */
function SimulcastUtils() { function SimulcastUtils() {
this.logger = new SimulcastLogger("SimulcastUtils"); this.logger = new SimulcastLogger("SimulcastUtils", 1);
} }
/** /**
@ -226,7 +226,7 @@ SimulcastUtils.prototype._compileVideoSources = function (videoSources) {
function SimulcastReceiver() { function SimulcastReceiver() {
this.simulcastUtils = new SimulcastUtils(); this.simulcastUtils = new SimulcastUtils();
this.logger = new SimulcastLogger('SimulcastReceiver'); this.logger = new SimulcastLogger('SimulcastReceiver', 1);
} }
SimulcastReceiver.prototype._remoteVideoSourceCache = ''; SimulcastReceiver.prototype._remoteVideoSourceCache = '';
@ -487,7 +487,7 @@ SimulcastReceiver.prototype.getRemoteVideoStreamIdBySSRC = function (ssrc) {
function SimulcastSender() { function SimulcastSender() {
this.simulcastUtils = new SimulcastUtils(); this.simulcastUtils = new SimulcastUtils();
this.logger = new SimulcastLogger('SimulcastSender'); this.logger = new SimulcastLogger('SimulcastSender', 1);
} }
SimulcastSender.prototype._localVideoSourceCache = ''; SimulcastSender.prototype._localVideoSourceCache = '';
@ -1198,20 +1198,27 @@ SimulcastManager.prototype._setLocalVideoStreamEnabled = function(ssrc, enabled)
* *
* @constructor * @constructor
*/ */
function SimulcastLogger(name) { function SimulcastLogger(name, lvl) {
this.name = name; this.name = name;
this.lvl = lvl;
} }
SimulcastLogger.prototype.log = function (text) { SimulcastLogger.prototype.log = function (text) {
if (this.lvl) {
console.log(text); console.log(text);
}
}; };
SimulcastLogger.prototype.info = function (text) { SimulcastLogger.prototype.info = function (text) {
if (this.lvl > 1) {
console.info(text); console.info(text);
}
}; };
SimulcastLogger.prototype.fine = function (text) { SimulcastLogger.prototype.fine = function (text) {
if (this.lvl > 2) {
console.log(text); console.log(text);
}
}; };
SimulcastLogger.prototype.error = function (text) { SimulcastLogger.prototype.error = function (text) {