From a5ae0270431cb242c1d4bb3085d321d0755a6165 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 27 Apr 2016 15:03:41 +0200 Subject: [PATCH] make logging configurable --- NetfluxWebsocketSrv.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NetfluxWebsocketSrv.js b/NetfluxWebsocketSrv.js index 2bc4f3f1d..13ec51cca 100644 --- a/NetfluxWebsocketSrv.js +++ b/NetfluxWebsocketSrv.js @@ -8,6 +8,8 @@ const HISTORY_KEEPER_ID = Crypto.randomBytes(8).toString('hex'); const USE_HISTORY_KEEPER = true; const USE_FILE_BACKUP_STORAGE = true; +const LOG_MESSAGES = false; + let dropUser; @@ -15,7 +17,7 @@ const now = function () { return (new Date()).getTime(); }; const sendMsg = function (ctx, user, msg) { try { - console.log('<' + JSON.stringify(msg)); + if (LOG_MESSAGES) { console.log('<' + JSON.stringify(msg)); } user.socket.send(JSON.stringify(msg)); } catch (e) { console.log(e.stack); @@ -181,7 +183,7 @@ let run = module.exports.run = function (storage, socketServer) { ctx.users[user.id] = user; sendMsg(ctx, user, [0, '', 'IDENT', user.id]); socket.on('message', function(message) { - console.log('>'+message); + if (LOG_MESSAGES) { console.log('>'+message); } try { handleMessage(ctx, user, message); } catch (e) {