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

dynamic-express-logging

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-express-logging

express logging for incoming request and response

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

express-logging

express logging for incoming request and response

Features

  • Logging every incoming request
  • Logging every response
  • Option to mask all request/response body
  • Option to mask specific headers
  • You can use any logger you want

Please notice, in case that you want to mask a header from all your request, you have to add object in the JSON for every endpoint

How to use

1- npm install dynamic-express-logging 2- In your index.js file add these lines:

var dynamicExpressLogging = require('dynamic-express-logging');
dynamicExpressLogging.init(`your logger`,`JSON object to mask your request and response body & headers`);
app.use(dynamicExpressLogging.requestMiddleware);

mask JSON object

[
  {
    "endPoint": "`endPoint`",
    "method": "`METHOD`",
    "headers":[
      `header keys`
    ]
  }
]
JSON EXAMPLE
[
  {
    "endPoint": "/v1/health",
    "method": "GET",
    "headers":[
      "user-agent"
    ]
  }
]

Full example:

var dynamicExpressLogging = require('dynamic-express-logging');
var bunyan = require('bunyan'); // you can use your logger
var logger = bunyan.createLogger();
var maskObject = [
                   {
                     "endPoint": "/v1/health",
                     "method": "GET",
                     "headers":[
                       "user-agent"
                     ]
                   }
                 ]
dynamicExpressLogging.init(logger,maskObject);
app.use(dynamicExpressLogging.requestMiddleware);

FAQs

Package last updated on 29 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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