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

auto-debug

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-debug

Uses debug but automatically assumes file as log namespace. Optionally logs line numbers, function arguments, and even traces.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

auto-debug

Uses debug but automatically assumes filenames as the log namespace. Optionally logs line numbers, function arguments, and caller location.

Usage

debug(/* args */)

// lib/example.js
var debug = require('auto-debug')();

module.exports = function someFunction () {
  debug('hello'); // this line 5
  /*
    prints:
    lib/example.js:5 someFunction hello
  */
  /*
    equivalent to require('debug')('lib/example.js')(':5 someFunction hello')
  */
};

debug.trace()

// lib/example2.js
var debug = require('auto-debug')();
process.env.DEBUG_TRACE = 'true'; // since debug trace can be noisey it only prints when DEBUG_TRACE is not set
function add (a, b, c) {
  debug.trace(); // this line 5
  /*
    prints:
    lib/example2.js:5 add hello { a:10, b:20, c:30} from main lib/example2.js:16
  */
  /*
    equivalent to require('debug')('lib/example2.js')(':5 add hello { a:10, b:20, c:30} from main lib/example2.js:16')
  */
};

(function main () {
  add(10, 20, 30) // line 16
})()

License

MIT

Keywords

FAQs

Package last updated on 21 Jul 2015

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