New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-driftwood

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-driftwood

Express middleware for logging with driftwood

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62
increased by210%
Maintainers
2
Weekly downloads
 
Created
Source

express-driftwood

A tiny piece of express middleware for logging requests using QubitProducts/driftwood.

Installation

npm i driftwood express-driftwood

Usage

Just call express-driftwood with an instance of driftwood and mount it in your express app before everything else:

const createLogger = require('driftwood')
const expressLogger = require('./index')
const express = require('express')

createLogger.enable({ '*': 'trace' })

const log = createLogger('my-app')
const app = express()

app.use(expressLogger(log))
app.get('/', (req, res) => res.send('Wooo!'))
app.get('/400', (req, res) => res.status(400).send('You dun goofed'))
app.get('/500', (req, res) => res.status(500).send('We dun goofed'))

app.listen(1119, () => {
  log.info('my-app started!')
})

Options

Options can be passed as a second argument.

options.ignore

A string, regex, function or array of the former, to match URLs that you don't want to log:

{
  ignore: ['/status', /^\/status/, (url) => url.indexOf('/status') > -1]
}

options.rewrite

A function that rewrites urls, e.g. to remove sensitive data:

{
  rewrite: (url) => url.replace('secret', '*****')
}

Keywords

FAQs

Package last updated on 23 Oct 2019

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