From cf124803e785daa9033164f8294fb73fe70880ba Mon Sep 17 00:00:00 2001 From: Manuel Mitasch Date: Thu, 3 Nov 2022 21:18:27 +0100 Subject: [PATCH] Hide most console.log on production builds. --- app/services/chataigne-websocket.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/services/chataigne-websocket.js b/app/services/chataigne-websocket.js index d0a0cd3..359be7f 100644 --- a/app/services/chataigne-websocket.js +++ b/app/services/chataigne-websocket.js @@ -89,17 +89,17 @@ export default class WebsocketService extends Service { sendFeedback(address, value) { const data = { 'controlAddress' : address, 'value': value }; - console.log('Sending feedback for ' + address + ': ' + value); + devLog('Sending feedback for ' + address + ': ' + value); this.socket.send(JSON.stringify(data)); } send(data) { - console.log('Sending feedback : ' + JSON.stringify(data)); + devLog('Sending feedback : ' + JSON.stringify(data)); this.socket.send(JSON.stringify(data)); } handleFeedback(payload) { - console.log('Updating feedback ' + payload.controlAddress + ': ' + payload.value); + devLog('Updating feedback ' + payload.controlAddress + ': ' + payload.value); if (!payload.type) return; let type = getControlType(payload.type); @@ -198,7 +198,7 @@ export default class WebsocketService extends Service { } handleUiFeedback(payload) { - console.log('Updating uiFeedback ' + payload.controlAddress + ': ' + payload.value); + devLog('Updating uiFeedback ' + payload.controlAddress + ': ' + payload.value); if (!payload.targetType) return; @@ -301,7 +301,7 @@ export default class WebsocketService extends Service { } legacyHandleFeedback(payload) { - console.log('Legacy Updating ' + payload.controlAddress + ': ' + payload.value); + devLog('Legacy Updating ' + payload.controlAddress + ': ' + payload.value); this.store.peekAll('texture').forEach(function(item) { if (item.itemControlAddress == payload.controlAddress) { @@ -467,4 +467,9 @@ function getControlType(type) { } return type; } - \ No newline at end of file + + function devLog(s) { + if (ENV.environment == 'development') { + console.log(s); + } + } \ No newline at end of file