Skip to content

Commit

Permalink
Fix issue #177
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners committed Jan 18, 2017
1 parent 98af53d commit 9e73fe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pino.js
Expand Up @@ -205,7 +205,7 @@ Object.defineProperty(Pino.prototype, 'levelVal', {
this[key] = noop
continue
}
this[key] = isStandardLevel(key) ? Pino.prototype[key] : genLog(num)
this[key] = isStandardLevel(key) ? Pino.prototype[key] : genLog(this.levels.values[key])
}
}
})
Expand Down
9 changes: 9 additions & 0 deletions test/addlevel.test.js
Expand Up @@ -80,6 +80,15 @@ test('reject already known values', function (t) {
}
})

test('level numbers are logged correctly after level change', function (t) {
t.plan(1)
var log = pino({level: 'foo', levelVal: 25}, sink(function (chunk, enc, cb) {
t.is(chunk.level, 25)
}))
log.level = 'debug'
log.foo('bar')
})

test('levels state is not shared between instances', function (t) {
t.plan(2)

Expand Down

0 comments on commit 9e73fe7

Please sign in to comment.