Socket
Book a DemoInstallSign in
Socket

event-debug

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

event-debug

Log all events emitted by a Node.js EventEmitter object

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
58
152.17%
Maintainers
1
Weekly downloads
 
Created
Source

event-debug

Log all events emitted by a Node.js EventEmitter object.

npm Build status js-standard-style

Installation

npm install event-debug

Usage

Example HTTP server where we log all event emitted by the server:

var http = require('http')
var eventDebug = require('event-debug')

var server = http.createServer(function (req, res) {
  console.log('-- Received request')

  eventDebug(req) // 1st argument should behave like an EventEmitter
  eventDebug(res)

  res.end('Hello World')
})

eventDebug(server, 'MyServer') // use custom logging prefix 'MyServer'

server.listen(3000, function () {
  console.log('-- Server is running on port 3000')
})

When running this server and sending an HTTP request to it, the following output will be produced (the lines written by event-debug are all written to STDERR):

screen shot 2017-03-27 at 23 36 03

License

MIT

Keywords

debug

FAQs

Package last updated on 06 Dec 2018

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