From b494d8f51e3ce921e799d84b16140f7a43e2eb34 Mon Sep 17 00:00:00 2001 From: Thomas Erbe Date: Sun, 3 Aug 2014 22:40:02 +0100 Subject: [PATCH 1/2] dded ability to replace console https://github.com/pimterry/loglevel/issues/42 --- lib/loglevel.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/loglevel.js b/lib/loglevel.js index d6ceca2..506cf7e 100644 --- a/lib/loglevel.js +++ b/lib/loglevel.js @@ -203,6 +203,16 @@ return self; }; + // Replace console.log with loglevel https://github.com/pimterry/loglevel/issues/42 + var _console = window.console; + self.replaceConsole = function() { + window.console = self; + } + + self.restoreConsole = function() { + window.console = _console; + } + loadPersistedLevel(); return self; })); From d76469a8c80ff678162b00e3e0af0e7eaaf185a9 Mon Sep 17 00:00:00 2001 From: Thomas Erbe Date: Wed, 6 Aug 2014 23:32:37 +0100 Subject: [PATCH 2/2] Fix jshint errors --- lib/loglevel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/loglevel.js b/lib/loglevel.js index 506cf7e..d93b870 100644 --- a/lib/loglevel.js +++ b/lib/loglevel.js @@ -207,11 +207,11 @@ var _console = window.console; self.replaceConsole = function() { window.console = self; - } + }; self.restoreConsole = function() { window.console = _console; - } + }; loadPersistedLevel(); return self;