Comparing version 10.0.0 to 10.1.0
@@ -122,3 +122,3 @@ 'use strict' | ||
}), | ||
errorMessage(req, res, error) | ||
errorMessage(req, res, error, responseTime) | ||
) | ||
@@ -125,0 +125,0 @@ |
{ | ||
"name": "pino-http", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"description": "High-speed HTTP logger for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "logger.js", |
@@ -950,2 +950,22 @@ 'use strict' | ||
test('pass responseTime argument to the custom errorMessage callback', function (t) { | ||
const dest = split(JSON.parse) | ||
const customErrorMessage = 'Response time is:' | ||
const logger = pinoHttp({ | ||
customErrorMessage: function (req, res, err, responseTime) { | ||
return `${customErrorMessage} ${responseTime} ${req.method}` | ||
} | ||
}, dest) | ||
setup(t, logger, function (err, server) { | ||
t.error(err) | ||
doGet(server, ERROR_URL) | ||
}) | ||
dest.on('data', function (line) { | ||
t.match(line.msg, /Response time is: \d+ GET/) | ||
t.end() | ||
}) | ||
}) | ||
test('uses the custom successObject callback if passed in as an option', function (t) { | ||
@@ -952,0 +972,0 @@ const dest = split(JSON.parse) |
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
80452
1896