Comparing version 5.3.0 to 5.4.0
@@ -97,3 +97,3 @@ 'use strict' | ||
if (reqCustomProps) { | ||
var customPropBindings = (typeof reqCustomProps === 'function') ? reqCustomProps(req) : reqCustomProps | ||
var customPropBindings = (typeof reqCustomProps === 'function') ? reqCustomProps(req, res) : reqCustomProps | ||
log = log.child(customPropBindings) | ||
@@ -100,0 +100,0 @@ } |
{ | ||
"name": "pino-http", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"description": "High-speed HTTP logger for Node.js", | ||
@@ -21,5 +21,6 @@ "main": "logger.js", | ||
"scripts": { | ||
"benchmark": "./scripts/benchmark-all", | ||
"benchmark": "bash ./scripts/benchmark-all", | ||
"test": "standard && tap --no-cov test.js", | ||
"ci": "standard && tap --cov test.js" | ||
"ci": "standard && tap --cov test.js", | ||
"fix": "standard --fix" | ||
}, | ||
@@ -26,0 +27,0 @@ "author": "David Mark Clements", |
@@ -108,3 +108,3 @@ # pino-http [![Build Status](https://img.shields.io/github/workflow/status/pinojs/pino-http/CI)](https://github.com/pinojs/pino-http/actions) | ||
* `wrapSerializers`: when `false`, custom serializers will be passed the raw value directly. Defaults to `true`. | ||
* `reqCustomProps`: set to a `function (req) => { /* returns on object */ }` or `{ /* returns on object */ }` This function will be invoked for each request with `req` where we could pass additional properties that needs to be logged outside the `req`. | ||
* `reqCustomProps`: set to a `function (req,res) => { /* returns on object */ }` or `{ /* returns on object */ }` This function will be invoked for each request with `req` and `res` where we could pass additional properties that needs to be logged outside the `req`. | ||
`stream`: the destination stream. Could be passed in as an option too. | ||
@@ -173,5 +173,7 @@ | ||
// Define additional custom request properties | ||
reqCustomProps: function (req) { | ||
reqCustomProps: function (req,res) { | ||
return { | ||
customProp: req.customProp | ||
customProp: req.customProp, | ||
// user request-scoped data is in res.locals for express applications | ||
customProp2: res.locals.myCustomData | ||
} | ||
@@ -178,0 +180,0 @@ } |
@@ -764,4 +764,4 @@ 'use strict' | ||
var dest = split(JSON.parse) | ||
function customPropsHandler (req) { | ||
if (req) { | ||
function customPropsHandler (req, res) { | ||
if (req && res) { | ||
return { | ||
@@ -768,0 +768,0 @@ key1: 'value1', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40773
360