Nearest Phase Modulator

    event-debug

    2.1.0 • Public • Published

    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

    Install

    npm i event-debug

    DownloadsWeekly Downloads

    62

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    6.19 kB

    Total Files

    6

    Last publish

    Collaborators

    • watson