From 96c886776225ee457479ebabfab67ad3dd1e77bf Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 31 Oct 2014 18:14:14 -0300 Subject: [PATCH] clean logs and remove unnecesary code --- js/models/Async.js | 6 +++--- js/models/Identity.js | 4 ++-- js/models/Insight.js | 3 +-- js/models/Wallet.js | 9 +++------ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/js/models/Async.js b/js/models/Async.js index 1d31c01e8..0e9d0c522 100644 --- a/js/models/Async.js +++ b/js/models/Async.js @@ -202,12 +202,12 @@ Network.prototype._onMessage = function(enc) { this._deletePeer(sender); return; } - log.debug('Async: receiving ' + JSON.stringify(payload)); if (this.ignoreMessageFromTs && this.ignoreMessageFromTs === enc.ts) { - log.debug('Ignoring message from ', enc.ts); + log.debug('Ignoring trailing message. Ts:', enc.ts); return; } + log.debug('Async: receiving ' + JSON.stringify(payload)); var self = this; switch (payload.type) { @@ -352,7 +352,7 @@ Network.prototype.start = function(opts, openCallback) { }; Network.prototype.createSocket = function() { - log.debug('Async: Connecting to socket:', this.url, this.socketOptions); + log.debug('Async: Connecting to socket:', this.url); return io.connect(this.url, this.socketOptions); }; diff --git a/js/models/Identity.js b/js/models/Identity.js index a63db37c4..4d4ffb221 100644 --- a/js/models/Identity.js +++ b/js/models/Identity.js @@ -158,7 +158,7 @@ Identity.prototype.retrieveWalletFromStorage = function(walletId, opts, callback return callback(error); } try { - log.debug('## OPENING Wallet: ' + walletId); + log.debug('## OPENING Wallet:', self.getName(), walletId); if (_.isString(walletData)) { walletData = JSON.parse(walletData); } @@ -376,7 +376,7 @@ Identity.prototype.bindWallet = function(w) { var self = this; self.wallets[w.getId()] = w; - log.debug('Binding wallet ' + w.getName()); + log.debug('Binding wallet:' + w.getName()); w.on('txProposalsUpdated', function() { Identity.storeWalletDebounced(self, w); diff --git a/js/models/Insight.js b/js/models/Insight.js index 39761a8de..2a07a56d7 100644 --- a/js/models/Insight.js +++ b/js/models/Insight.js @@ -124,7 +124,7 @@ Insight.prototype.subscribeToBlocks = function() { /** @private */ Insight.prototype._getSocketIO = function(url, opts) { - log.debug('Insight: Connecting to socket:', this.url, this.opts); + log.debug('Insight: Connecting to socket:', this.url); return io(this.url, this.opts); }; @@ -200,7 +200,6 @@ Insight.prototype.subscribe = function(addresses) { var self = this; function handlerFor(self, address) { -console.log('HANDLER [Insight.js.150:address:]',address); //TODO return function(txid) { // verify the address is still subscribed if (!self.subscribed[address]) return; diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 1ecf098db..8ef0b9092 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -116,7 +116,8 @@ function Wallet(opts) { inherits(Wallet, events.EventEmitter); Wallet.prototype.emitAndKeepAlive = function(args) { - log.debug('Wallet Emitting:', arguments); + var args = Array.prototype.slice.call(arguments); + log.debug('Wallet Emitting:', args); this.keepAlive(); this.emit.apply(this, arguments); }; @@ -810,7 +811,7 @@ Wallet.prototype._setBlockchainListeners = function() { var self = this; self.blockchain.removeAllListeners(); - log.debug('Setting Blockchain listeners for', this.getId()); + log.debug('Setting Blockchain listeners for', this.getName()); self.blockchain.on('reconnect', function(attempts) { log.debug('Wallet:' + self.id + 'blockchain reconnect event'); self.emitAndKeepAlive('insightReconnected'); @@ -888,12 +889,8 @@ Wallet.prototype.netStart = function() { log.debug('Wallet:' + self.id + ' Starting networking: ' + startOpts.copayerId); net.start(startOpts, function() { - log.debug('Wallet:' + self.id + ' Networking ready:', net.copayerId); self._setBlockchainListeners(); self.emitAndKeepAlive('ready', net.getPeer()); - setTimeout(function() { - self._newAddresses(true); - }, 0); }); };