mv log to util

This commit is contained in:
Matias Alejo Garcia 2014-12-02 11:17:03 -03:00
parent 581991b83e
commit cfa5748f74
18 changed files with 32 additions and 26 deletions

View File

@ -6,7 +6,7 @@ module.exports.PrivateKey = require('./js/models/PrivateKey');
module.exports.HDPath = require('./js/models/HDPath'); module.exports.HDPath = require('./js/models/HDPath');
module.exports.HDParams = require('./js/models/HDParams'); module.exports.HDParams = require('./js/models/HDParams');
module.exports.crypto = require('./js/util/crypto'); module.exports.crypto = require('./js/util/crypto');
module.exports.logger = require('./js/log'); module.exports.logger = require('./js/util/log');
// components // components

View File

@ -2,7 +2,7 @@
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var bitcore = require('bitcore'); var bitcore = require('bitcore');
var log = require('../log'); var log = require('../util/log');
var AuthMessage = bitcore.AuthMessage; var AuthMessage = bitcore.AuthMessage;
var util = bitcore.util; var util = bitcore.util;
var nodeUtil = require('util'); var nodeUtil = require('util');

View File

@ -5,7 +5,7 @@ var Wallet = require('./Wallet');
var cryptoUtils = require('../util/crypto'); var cryptoUtils = require('../util/crypto');
var CryptoJS = require('node-cryptojs-aes').CryptoJS; var CryptoJS = require('node-cryptojs-aes').CryptoJS;
var sjcl = require('../../lib/sjcl'); var sjcl = require('../../lib/sjcl');
var log = require('../log'); var log = require('../util/log');
var preconditions = require('preconditions').instance(); var preconditions = require('preconditions').instance();
var _ = require('lodash'); var _ = require('lodash');

View File

@ -3,7 +3,7 @@ var _ = require('lodash');
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
var inherits = require('inherits'); var inherits = require('inherits');
var events = require('events'); var events = require('events');
var log = require('../log'); var log = require('../util/log');
var async = require('async'); var async = require('async');
var bitcore = require('bitcore'); var bitcore = require('bitcore');
@ -122,7 +122,7 @@ Identity.open = function(opts, cb) {
var storage = opts.storage || opts.pluginManager.get('DB'); var storage = opts.storage || opts.pluginManager.get('DB');
storage.setCredentials(opts.email, opts.password, opts); storage.setCredentials(opts.email, opts.password, opts);
storage.getItem(Identity.getKeyForEmail(opts.email), function(err, data, headers) { storage.getItem(Identity.getKeyForEmail(opts.email), function(err, data) {
var exported; var exported;
if (err) { if (err) {
return cb(err); return cb(err);
@ -132,7 +132,7 @@ Identity.open = function(opts, cb) {
} catch (e) { } catch (e) {
return cb(e); return cb(e);
} }
return cb(null, new Identity(_.extend(opts, exported)), headers); return cb(null, new Identity(_.extend(opts, exported)));
}); });
}; };
@ -553,8 +553,8 @@ Identity.prototype.createWallet = function(opts, cb) {
var self = this; var self = this;
var w = new walletClass(opts); var w = new walletClass(opts);
self.bindWallet(w);
self.updateFocusedTimestamp(w.getId()); self.updateFocusedTimestamp(w.getId());
self.bindWallet(w);
self.storeWallet(w, function(err) { self.storeWallet(w, function(err) {
if (err) return cb(err); if (err) return cb(err);
self.store({ self.store({
@ -619,10 +619,11 @@ Identity.prototype.deleteWallet = function(walletId, cb) {
delete this.focusedTimestamps[walletId]; delete this.focusedTimestamps[walletId];
this.storage.removeItem(Wallet.getStorageKey(walletId), function(err) { this.storage.removeItem(Wallet.getStorageKey(walletId), function(err) {
if (err) return cb(err); if (err) {
return cb(err);
}
self.emitAndKeepAlive('deletedWallet', walletId); self.emitAndKeepAlive('deletedWallet', walletId);
self.store(null, cb); self.store(null, cb);
return cb();
}); });
}; };

View File

@ -3,14 +3,16 @@
var util = require('util'); var util = require('util');
var async = require('async'); var async = require('async');
var request = require('request'); var request = require('request');
var bitcore = require('bitcore');
var io = require('socket.io-client'); var io = require('socket.io-client');
var _ = require('lodash'); var _ = require('lodash');
var log = require('../log');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
var bitcore = require('bitcore');
var log = require('../util/log.js');
/* /*
This class lets interfaces with the blockchain, making general queries and This class lets interfaces with the blockchain, making general queries and
subscribing to transactions on adressess and blocks. subscribing to transactions on adressess and blocks.

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
var log = require('../log'); var log = require('../util/log');
function PluginManager(config) { function PluginManager(config) {
this.registered = {}; this.registered = {};

View File

@ -2,7 +2,7 @@
var preconditions = require('preconditions').instance(); var preconditions = require('preconditions').instance();
var _ = require('lodash'); var _ = require('lodash');
var log = require('../log'); var log = require('../util/log');
var bitcore = require('bitcore'); var bitcore = require('bitcore');
var HK = bitcore.HierarchicalKey; var HK = bitcore.HierarchicalKey;
var Address = bitcore.Address; var Address = bitcore.Address;

View File

@ -2,7 +2,7 @@
var util = require('util'); var util = require('util');
var _ = require('lodash'); var _ = require('lodash');
var log = require('../log'); var log = require('../util/log');
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
var request = require('request'); var request = require('request');

View File

@ -10,7 +10,7 @@ var TransactionBuilder = bitcore.TransactionBuilder;
var Script = bitcore.Script; var Script = bitcore.Script;
var Key = bitcore.Key; var Key = bitcore.Key;
var log = require('../log'); var log = require('../util/log');
var TX_MAX_SIZE_KB = 50; var TX_MAX_SIZE_KB = 50;
var VERSION = 1; var VERSION = 1;

View File

@ -9,7 +9,7 @@ var Script = bitcore.Script;
var Key = bitcore.Key; var Key = bitcore.Key;
var buffertools = bitcore.buffertools; var buffertools = bitcore.buffertools;
var log = require('../log'); var log = require('../util/log');
var TxProposal = require('./TxProposal');; var TxProposal = require('./TxProposal');;
function TxProposals(opts) { function TxProposals(opts) {

View File

@ -18,7 +18,7 @@ var Address = bitcore.Address;
var PayPro = bitcore.PayPro; var PayPro = bitcore.PayPro;
var Transaction = bitcore.Transaction; var Transaction = bitcore.Transaction;
var log = require('../log'); var log = require('../util/log');
var cryptoUtil = require('../util/crypto'); var cryptoUtil = require('../util/crypto');
var httpUtil = require('../util/HTTP'); var httpUtil = require('../util/HTTP');
var HDParams = require('./HDParams'); var HDParams = require('./HDParams');

View File

@ -1,7 +1,7 @@
var cryptoUtil = require('../util/crypto'); var cryptoUtil = require('../util/crypto');
var InsightStorage = require('./InsightStorage'); var InsightStorage = require('./InsightStorage');
var inherits = require('inherits'); var inherits = require('inherits');
var log = require('../log'); var log = require('../util/log');
var SEPARATOR = '%^#@'; var SEPARATOR = '%^#@';
function EncryptedInsightStorage(config) { function EncryptedInsightStorage(config) {

View File

@ -1,5 +1,5 @@
var cryptoUtil = require('../util/crypto'); var cryptoUtil = require('../util/crypto');
var log = require('../log'); var log = require('../util/log');
var LocalStorage = require('./LocalStorage'); var LocalStorage = require('./LocalStorage');
var inherits = require('inherits'); var inherits = require('inherits');

View File

@ -3,7 +3,7 @@
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
var loaded = 0; var loaded = 0;
var SCOPES = 'https://www.googleapis.com/auth/drive'; var SCOPES = 'https://www.googleapis.com/auth/drive';
var log = require('../log'); var log = require('../util/log');
function GoogleDrive(config) { function GoogleDrive(config) {
preconditions.checkArgument(config && config.clientId, 'No clientId at GoogleDrive config'); preconditions.checkArgument(config && config.clientId, 'No clientId at GoogleDrive config');

View File

@ -4,7 +4,7 @@ var bitcore = require('bitcore');
var buffers = require('buffer'); var buffers = require('buffer');
var querystring = require('querystring'); var querystring = require('querystring');
var Identity = require('../models/Identity'); var Identity = require('../models/Identity');
var log = require('../log'); var log = require('../util/log');
var SEPARATOR = '|'; var SEPARATOR = '|';

View File

@ -2,8 +2,9 @@
* Small module for some helpers that wrap sjcl with some good practices. * Small module for some helpers that wrap sjcl with some good practices.
*/ */
var sjcl = require('sjcl'); var sjcl = require('sjcl');
var log = require('../log.js');
var _ = require('lodash'); var _ = require('lodash');
var log = require('../util/log.js');
var config = require('../../config'); var config = require('../../config');
var defaultSalt = (config && config.passphraseConfig && config.passphraseConfig.storageSalt) || 'mjuBtGybi/4='; var defaultSalt = (config && config.passphraseConfig && config.passphraseConfig.storageSalt) || 'mjuBtGybi/4=';

View File

@ -1,5 +1,7 @@
var config = config || require('../config'); var config = config || require('../../config');
var _ = require('lodash'); var _ = require('lodash');
var LS = require('../plugins/LocalStorage');
var ls = new LS();
/** /**

View File

@ -109,8 +109,8 @@ var createBundle = function(opts) {
// The following 2 lines fix karma tests // The following 2 lines fix karma tests
b.require('sjcl'); b.require('sjcl');
b.require('./js/log', { b.require('./js/util/log', {
expose: '../log.js' expose: '../../log.js'
}); });
if (opts.debug) { if (opts.debug) {