diff --git a/gun.js b/gun.js index 916cc838..1d2bdcd0 100644 --- a/gun.js +++ b/gun.js @@ -191,6 +191,7 @@ Gun.log = function(a, b, c, d, e, f){ var gun = this; if(!gun || !gun.__ || !gun.__.opt){ + console.log(gun.__); return console.log.apply(console, arguments); } if(!gun.__.opt.verbose){ return } diff --git a/test/common.js b/test/common.js index 9f60dde2..72fdc703 100644 --- a/test/common.js +++ b/test/common.js @@ -319,6 +319,30 @@ describe('Gun', function(){ require('../lib/file'); var gun = Gun({file: 'data.json'}); + it('verbose mode works properly', function(done) { + gun.load('hello/world').get(function() { + var counter = 2; + var originalLog = console.log; + + /* + *console.log = function() { + * counter--; + *}; + */ + + Gun.log('this is a test'); + gun.opt({verbose: true}); + Gun.log('this is a test'); + + // Restore original console.log + console.log = originalLog; + expect(counter).to.be(1); + + // Finish asynchronous mocha test + done(); + }); + }); + it('set key get', function(done){ gun.set({hello: "world"}).key('hello/world').get(function(val){ expect(val.hello).to.be('world');