Skip to content

Commit

Permalink
rename .pino to .version, add .version to export
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmarkclements committed Jul 8, 2018
1 parent 7e60900 commit 86d8771
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/proto.js
Expand Up @@ -45,8 +45,8 @@ const prototype = {
flush,
addLevel,
isLevelEnabled,
version,
silent: noop,
pino: version,
get levelVal () { return this[getLevelValSym]() },
set levelVal (num) { return this[setLevelValSym](num) },
get level () { return this[getLevelSym]() },
Expand Down
3 changes: 2 additions & 1 deletion pino.js
Expand Up @@ -10,7 +10,7 @@ const proto = require('./lib/proto')
const symbols = require('./lib/symbols')
const { setLevelState, mappings } = require('./lib/levels')
const { createArgsNormalizer, asChindings } = require('./lib/tools')
const { LOG_VERSION } = require('./lib/meta')
const { version, LOG_VERSION } = require('./lib/meta')
const {
chindingsSym,
redactFmtSym,
Expand Down Expand Up @@ -106,6 +106,7 @@ pino.levels = mappings()
pino.stdSerializers = Object.assign({}, serializers)
pino.stdTimeFunctions = Object.assign({}, time)
pino.symbols = symbols
pino.version = version
pino.LOG_VERSION = LOG_VERSION

module.exports = pino
12 changes: 8 additions & 4 deletions test/basic.test.js
Expand Up @@ -8,14 +8,18 @@ const { version } = require('../package.json')
const { pid } = process
const hostname = os.hostname()

test('pino version is exposed', async ({is}) => {
test('pino version is exposed on export', async ({is}) => {
is(pino.version, version)
})

test('pino version is exposed on instance', async ({is}) => {
const instance = pino()
is(instance.pino, version)
is(instance.version, version)
})

test('child exposes pino version', async ({is}) => {
test('child instance exposes pino version', async ({is}) => {
const child = pino().child({foo: 'bar'})
is(child.pino, version)
is(child.version, version)
})

function levelTest (name, level) {
Expand Down

0 comments on commit 86d8771

Please sign in to comment.