Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino-http

Package Overview
Dependencies
Maintainers
4
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-http - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

.github/workflows/ci.yml

8

logger.js

@@ -113,3 +113,9 @@ 'use strict'

if (url && url.pathname) {
shouldLogSuccess = !autoLoggingIgnorePaths.includes(url.pathname)
shouldLogSuccess = !autoLoggingIgnorePaths.find(ignorePath => {
if (ignorePath instanceof RegExp) {
return ignorePath.test(url.pathname)
}
return ignorePath === url.pathname
})
}

@@ -116,0 +122,0 @@ }

2

package.json
{
"name": "pino-http",
"version": "5.2.0",
"version": "5.3.0",
"description": "High-speed HTTP logger for Node.js",

@@ -5,0 +5,0 @@ "main": "logger.js",

@@ -1,2 +0,2 @@

# pino-http  [![Build Status](https://travis-ci.org/pinojs/pino-http.svg)](https://travis-ci.org/pinojs/pino-http)[![Coverage Status](https://coveralls.io/repos/github/pinojs/pino-http/badge.svg?branch=master)](https://coveralls.io/github/pinojs/pino-http?branch=master)
# pino-http  [![Build Status](https://img.shields.io/github/workflow/status/pinojs/pino-http/CI)](https://github.com/pinojs/pino-http/actions)

@@ -105,6 +105,6 @@ High-speed HTTP logger for Node.js

* `customSuccessMessage`: set to a `function (res) => { /* returns message string */ }` This function will be invoked at each successful response, setting "msg" property to returned string. If not set, default value will be used.
* `customErrorMessage`: set to a `function (res, err) => { /* returns message string */ }` This function will be invoked at each failed response, setting "msg" property to returned string. If not set, default value will be used.
* `customAttributeKeys`: allows the log object attributes added by `pino-http` to be given custom keys. Accepts an object of format `{ [original]: [override] }`. Attributes available for override are `req`, `res`, `err`, and `responseTime`.
* `customErrorMessage`: set to a `function (err, res) => { /* returns message string */ }` This function will be invoked at each failed response, setting "msg" property to returned string. If not set, default value will be used.
* `customAttributeKeys`: allows the log object attributes added by `pino-http` to be given custom keys. Accepts an object of format `{ [original]: [override] }`. Attributes available for override are `req`, `res`, `err`, and `responseTime`.
* `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) => { /* 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`.
`stream`: the destination stream. Could be passed in as an option too.

@@ -159,3 +159,3 @@

},
// Define a custom error message

@@ -172,3 +172,3 @@ customErrorMessage: function (error, res) {

},
// Define additional custom request properties

@@ -179,3 +179,3 @@ reqCustomProps: function (req) {

}
}
}
})

@@ -182,0 +182,0 @@

@@ -380,2 +380,26 @@ 'use strict'

test('no auto logging with autoLogging set to use regular expressions. result is ignored', function (t) {
var dest = split(JSON.parse)
var logger = pinoHttp({
autoLogging: {
ignorePaths: [/\/[A-z]{4}\/ignorethis/, '/another-ignored-path'],
getPath: function (req) {
return req.url
}
}
}, dest)
setup(t, logger, function (err, server) {
t.error(err)
doGet(server, '/abcd/ignorethis')
doGet(server, '/another-ignored-path')
doGet(server, '/abcd0/shouldlogthis')
})
dest.on('data', function (line) {
t.pass('path should log')
t.end()
})
})
test('support a custom instance', function (t) {

@@ -654,3 +678,3 @@ var dest = split(JSON.parse)

var logger = pinoHttp({
customSuccessMessage: function () {
customSuccessMessage: function (res) {
return customResponseMessage

@@ -675,4 +699,4 @@ }

var logger = pinoHttp({
customErrorMessage: function () {
return customErrorMessage
customErrorMessage: function (err, res) {
return customErrorMessage + ' ' + err.toString()
}

@@ -687,3 +711,3 @@ }, dest)

dest.on('data', function (line) {
t.equal(line.msg, customErrorMessage)
t.contains(line.msg, customErrorMessage)
t.end()

@@ -690,0 +714,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc