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

koa-driftwood

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-driftwood

Koa middleware for logging with driftwood

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

express-driftwood

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

Installation

npm i driftwood koa-driftwood

Usage

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

const createLogger = require('driftwood')
const Koa = require('koa')
const router = require('koa-router')()
const koaLogger = require('koa-driftwood')

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

const log = createLogger('my-app')
const app = new Koa()

app.use(koaLogger(log))

router.get('/', (ctx) => { res.body = 'Wooo!' })
router.get('/400', (ctx) => { ctx.status = 400; ctx.body = 'You dun goofed' })
router.get('/500', (ctx) => { ctx.status = 500; ctx.body = 'We dun goofed' })

app.use(router.routes())

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]
}

Keywords

FAQs

Package last updated on 19 Oct 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