Skip to content

Commit

Permalink
Merge pull request #34 from ajwagner777/master
Browse files Browse the repository at this point in the history
Added debug handler
  • Loading branch information
jonnyreeves authored Aug 22, 2016
2 parents 849ad65 + b914a2a commit 94662db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@
hdlr = console.error;
} else if (context.level === Logger.INFO && console.info) {
hdlr = console.info;
} else if (context.level === Logger.DEBUG && console.debug) {
hdlr = console.debug;
}

options.formatter(messages, context);
Expand Down
4 changes: 2 additions & 2 deletions test-src/loggertests.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
var logger = this.logger;

var sandbox = sinon.sandbox.create();
sandbox.stub(console, "log");
sandbox.stub(console, "debug");
sandbox.stub(console, "info");
sandbox.stub(console, "warn");
sandbox.stub(console, "error");
Expand All @@ -174,7 +174,7 @@
logger.warn("warning message");
logger.error("error message");

assert.ok(console.log.calledOnce, "logger.debug calls console.log");
assert.ok(console.debug.calledOnce, "logger.debug calls console.debug");
assert.ok(console.info.calledOnce, "logger.info calls console.info");
assert.ok(console.warn.calledOnce, "logger.warn calls console.warn");
assert.ok(console.error.calledOnce, "logger.error calls console.error");
Expand Down

0 comments on commit 94662db

Please sign in to comment.