Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
test
.gitignore
.npmignore
.travis.yml
History.md
LICENSE
README.md
component.json
index.js
package.json

README.md

simple-debug Build Status

Simple tool to limit log output. It's configuration is compatible with visionmedia/debug.

Examples

Basic

var debug = require('simple-debug')('mything');

setInterval(function(){
  debug('doing something useful');
}, 1000);

The DEBUG environment variable used to enable logging. Give it space- or comma-separated names.

$ DEBUG=mything node myapp
doing something useful
doing something useful
doing something useful

Multiple

var debug = require('simple-debug');
debug.working = debug('working');
debug.waiting = debug('waiting');

setInterval(function(){
  debug.working('doing something useful');
  // ...
  debug.waiting('pausing for 1s');
}, 1000);

Turn on only the waiting log.

$ DEBUG=waiting node myapp
pausing for 1s
pausing for 1s

Turn on both.

$ DEBUG=waiting,working node myapp
doing something useful
pausing for 1s
doing something useful
pausing for 1s

Output Stream

Send output through console.err instead of console.log.

var debug = require('simple-debug')('mything');
debug.log = console.error.bind(console);

setInterval(function(){
  debug('doing something useful');
}, 1000);

License

MIT. The core functions were extracted from debug. See LICENSE for details.

Something went wrong with that request. Please try again.