add tests to log

This commit is contained in:
Matias Alejo Garcia 2014-12-02 11:55:29 -03:00
commit 43bd277959
4 changed files with 51 additions and 6 deletions

View file

@ -110,7 +110,7 @@ PublicKeyRing.fromObj = function(opts) {
}
if (opts.cache && opts.cache.addressToPath) {
log.info('PublicKeyRing: Using address cache');
log.debug('PublicKeyRing: Using address cache');
pkr.cache.addressToPath = opts.cache.addressToPath;
pkr.rebuildCache();
}

View file

@ -1,8 +1,12 @@
'use strict';
var _ = require('lodash');
var preconditions = require('preconditions').singleton();
function LocalStorage() {
this.type = 'DB';
preconditions.checkState(typeof localStorage !== 'undefined',
'localstorage not available, cannot run plugin');
};
LocalStorage.prototype.init = function() {

View file

@ -1,9 +1,11 @@
var config = config || require('../../config');
var _ = require('lodash');
var ls;
var LS = require('../plugins/LocalStorage');
var ls = new LS();
try {
var LS = require('../plugins/LocalStorage');
ls = new LS();
} catch(e) {};
/**
* @desc
@ -122,9 +124,9 @@ Logger.prototype.setLevel = function(level) {
var logger = new Logger('copay');
var error = new Error();
var logLevel = config.logLevel;
var logLevel = config.logLevel || 'info';
if (ls.getItem) {
if (ls && ls.getItem) {
ls.getItem("config", function(err, value) {
if (err) return;
var localConfig = JSON.parse(value);