implemented outgoing log filter

This commit is contained in:
logsol 2014-03-31 05:01:05 +02:00
parent f90076c7fb
commit 40e396fc23
2 changed files with 22 additions and 3 deletions

View file

@ -96,8 +96,27 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
Networker.prototype.sendCommand = function (command, options) {
var message = ProtocolHelper.encodeCommand(command, options);
this.socketLink.send(message);
if(Settings.NETWORK_LOG_OUTGOING) {
console.log('OUTGOING', message);
if(Settings.NETWORK_LOG_FILTER.length > 0) {
var shouldBeFiltered = false;
var keyword;
for (var i = 0; i < Settings.NETWORK_LOG_FILTER.length; i++) {
keyword = Settings.NETWORK_LOG_FILTER[i];
if(message.search(keyword) != -1) {
shouldBeFiltered = true;
break;
}
};
if(!shouldBeFiltered) {
console.log('OUTGOING', message);
}
} else {
console.log('OUTGOING', message);
}
}
}
@ -144,7 +163,6 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
delete this.gameController;
}
console.log('GameController')
this.gameController = new GameController(options);
};