JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 59
  • Score
    100M100P100Q47372F
  • License MIT

simple, unintrusive, debug utility

Package Exports

  • utils-debug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (utils-debug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

utils-debug progressed.io

build NPM version
simple debug utility

example

'use strict';

require('utils-debug').enable();

console.log('hello');

someMethod();

function someMethod(){
  console.log('what up!');
}

and like you are used to

➜  utils-debug (master)DEBUG=example node example
at Object.<anonymous> (example.js:5:9)
hello
at someMethod (example.js:10:11)
what up!

but without any other function, just plain console.logs

install

npm install --save utils-debug

documentation

require('utils-debug').enable();

Thats basically it.

All console.logs of that file will not print to stdout if there is no DEBUG environment variable set.

If there is a DEBUG environment variable, just run it as you usually do with debug but instead of using some label you wrote on the source code of some file use the path of the file relative to the project. That is, if you project looks like below

project-dir
 |-lib
   |--> code.js
 |-index.js

and want to debug lib/code.js go ahead and write DEBUG=lib/code node index.js.

Yes, the extension is not necessary.

why

You want expressive, unintrusive debugging.

todo

  • make some tests
  • be able to turn on debugging projectwise
  • be able to format the output as much as one likes
  • sorten debugging paths for node_modules directory

license

LICENSE