Comparing version 5.0.1 to 5.1.0
@@ -109,2 +109,6 @@ 'use strict' | ||
tryAddEvent(server, options, 'on', 'response', function (request) { | ||
if (options.ignorePaths && ignoreTable[request.url.path]) { | ||
return | ||
} | ||
const info = request.info | ||
@@ -111,0 +115,0 @@ request.logger.info({ |
{ | ||
"name": "hapi-pino", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Hapi plugin for the Pino logger ", | ||
@@ -24,14 +24,14 @@ "main": "index.js", | ||
"flush-write-stream": "^1.0.3", | ||
"hapi": "^17.5.3", | ||
"lab": "^15.5.0", | ||
"hapi": "^17.5.4", | ||
"lab": "^16.0.0", | ||
"make-promises-safe": "^1.1.0", | ||
"pre-commit": "^1.1.2", | ||
"split2": "^2.2.0", | ||
"standard": "^11.0.0" | ||
"split2": "^3.0.0", | ||
"standard": "^12.0.0" | ||
}, | ||
"dependencies": { | ||
"abstract-logging": "^1.0.0", | ||
"hoek": "^5.0.3", | ||
"pino": "^5.0.1", | ||
"pino-pretty": "^2.0.1" | ||
"hoek": "^5.0.4", | ||
"pino": "^5.5.0", | ||
"pino-pretty": "^2.1.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "repository": { |
38
test.js
@@ -1005,2 +1005,40 @@ 'use strict' | ||
experiment('ignore response logs for paths in ignorePaths', () => { | ||
test('when path matches entry in ignorePaths, nothing should be logged', async () => { | ||
const server = getServer() | ||
let resolver | ||
const done = new Promise((resolve, reject) => { | ||
resolver = resolve | ||
}) | ||
const stream = sink((data) => { | ||
expect(data.msg).to.equal('request completed') | ||
expect(data.req.url).to.not.equal('/ignored') | ||
resolver() | ||
}) | ||
const logger = require('pino')(stream) | ||
const plugin = { | ||
plugin: Pino, | ||
options: { | ||
instance: logger, | ||
logEvents: ['response'], | ||
ignorePaths: ['/ignored'] | ||
} | ||
} | ||
await server.register(plugin) | ||
await server.inject({ | ||
method: 'PUT', | ||
url: '/ignored' | ||
}) | ||
await server.inject({ | ||
method: 'PUT', | ||
url: '/' | ||
}) | ||
await done | ||
}) | ||
}) | ||
experiment('logging with logRouteTags option enabled', () => { | ||
@@ -1007,0 +1045,0 @@ test('when logRouteTags is true, tags are part of the logged object', async () => { |
41205
1259
Updatedhoek@^5.0.4
Updatedpino@^5.5.0
Updatedpino-pretty@^2.1.0