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,9 +96,28 @@ 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) {
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);
}
}
}
Networker.prototype.sendGameCommand = function(command, options) {
@ -144,7 +163,6 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
delete this.gameController;
}
console.log('GameController')
this.gameController = new GameController(options);
};

View file

@ -64,7 +64,8 @@ define(function() {
WORLD_UPDATE_BROADCAST_INTERVAL: 70,
CHANNEL_DESTRUCTION_TIME: 30,
NETWORK_LOG_INCOMING: false,
NETWORK_LOG_OUTGOING: false,
NETWORK_LOG_OUTGOING: true,
NETWORK_LOG_FILTER: ['ping', 'pong', 'worldUpdate', 'lookAt'],
// CHANNEL
CHANNEL_END_ROUND_TIME: 10,