mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
implemented outgoing log filter
This commit is contained in:
parent
f90076c7fb
commit
40e396fc23
2 changed files with 22 additions and 3 deletions
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue