Socket
Socket
Sign inDemoInstall

simple-debugger

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-debugger

A simple way to debug events and methods of your classes


Version published
Weekly downloads
112
increased by53.42%
Maintainers
1
Weekly downloads
 
Created
Source

SimpleDebugger

A simple way to debug events and methods of your classes.

yarn add simple-debugger
const { inherits } = require('util')
const { debugEvents } = require('simple-debugger')
const { debugMethods } = require('simple-debugger')

const EventEmitter = require('events')

inherits(SomeClass, EventEmitter)
function SomeClass() {
  debugEvents(this)
  debugMethods(this, [ 'on', 'once', 'emit' ])
  this.init()
}

SomeClass.prototype.init = function() {
  //...
  this.emit('ready')
}

new SomeClass()

/* $ DEBUG=debugEvents*,debugMethods* node .
   debugMethods:SomeClass #init +0ms
   debugEvents:SomeClass !inited +2ms
*/

const { debugEvents } = require('simple-debugger')
const { debugMethods } = require('simple-debugger')

const request = require('request')
const google = request('https://google.com')

debugEvents(google, [], 'google')
debugMethods(google, [ 'on', 'once', 'emit' ], 'google')

/* $ DEBUG=debugEvents*,debugMethods* node .
   debugMethods:google $end +0ms
   debugMethods:google $start +0ms
   debugEvents:google !request - [ClientRequest] +0ms
   debugEvents:google !socket - [TLSSocket] +1ms
   debugMethods:google #onRequestResponse - [IncomingMessage] +349ms
   debugMethods:google #getHeader - host +1ms
   ...
*/

Keywords

FAQs

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