Skip to content

Commit

Permalink
fix crash from trying to reset placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
keis committed Dec 12, 2014
1 parent b75c0e2 commit 60eb950
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/index.js
Expand Up @@ -206,8 +206,7 @@ Hierarchy.prototype.forEachSink = function (iteratee) {

// Assemble a list of all unique sinks in the hierarchy
for (k in loggers) {
if (loggers.hasOwnProperty(k)) {
sinks = loggers[k].sinks;
if (loggers.hasOwnProperty(k) && (sinks = loggers[k].sinks)) {
for (i = 0, length = sinks.length; i < length; i++) {
sink = sinks[i];

Expand Down
6 changes: 3 additions & 3 deletions test/unit/test.hierarchy.coffee
Expand Up @@ -48,8 +48,8 @@ describe "Hierarchy", ->
assert.strictEqual subb.parent, log

it "resets the sinks of all attached loggers", ->
suba = hier.getLogger 'foo'
subb = hier.getLogger 'bar'
suba = hier.getLogger 'foo.bar'
subb = hier.getLogger 'foo.baz'

sinka = new Sink
sinka.reset = sinon.stub()
Expand All @@ -66,7 +66,7 @@ describe "Hierarchy", ->
assert.calledOnce sinka.reset
assert.calledOnce sinkb.reset

it "reused sink is reset once", ->
it "resets a reused sink once", ->
suba = hier.getLogger 'foo'
subb = hier.getLogger 'bar'

Expand Down

0 comments on commit 60eb950

Please sign in to comment.