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

express-pino-logger

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-pino-logger - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

4

package.json
{
"name": "express-pino-logger",
"version": "5.0.0",
"version": "6.0.0",
"description": "An express middleware to log with pino",

@@ -21,3 +21,3 @@ "main": "logger.js",

"dependencies": {
"pino-http": "^5.1.0"
"pino-http": "^5.3.0"
},

@@ -24,0 +24,0 @@ "devDependencies": {

@@ -105,2 +105,38 @@ # express-pino-logger  [![Build Status](https://travis-ci.org/pinojs/express-pino-logger.svg)](https://travis-ci.org/pinojs/express-pino-logger)

## Custom serializers
The `req` object for logging is constructed by [pino-std-serializers](https://github.com/pinojs/pino-std-serializers) and custom properties added to the `req` in previous middleware are not automatically included.
The original `req` is accessible in the custom serializer under `req.raw`.
```js
'use strict'
var app = require('express')()
var ExpressPinoLogger = require('express-pino-logger')()
var pino = ExpressPinoLogger({
serializers: {
req: (req) => ({
method: req.method,
url: req.url,
user: req.raw.user,
}),
},
})
// middleware that augments the req - must be added before the pino middleware
app.use((req, res, next) => {
req.user = 'testing';
next();
})
app.use(pino)
...
```
## API

@@ -107,0 +143,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