simple-debug

1.1.2 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i simple-debug

Weekly Downloads

123

Version

1.1.2

License

none

Last publish

Collaborators

  • timshadel