diff --git a/index.js b/index.js index 9d0b16d..d779f42 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,10 @@ function getLogger(namespace){ logger[level] = makeLogLevel(level); }); + logger.destroy = function(){ + logger.removeAllListeners(); + }; + return logger; } diff --git a/test/index.js b/test/index.js index c4a1da2..f2a9bae 100644 --- a/test/index.js +++ b/test/index.js @@ -22,7 +22,9 @@ describe('glogg', function(){ }); afterEach(function(done){ - logger.removeAllListeners(); + expect(global['glogg-test']).to.exist(); + logger.destroy(); + expect(global['glogg-test']).to.not.exist(); done(); });