Skip to content

louy/better-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better Debug

Circle CI npm npm Codacy Codecov VersionEye

A better alternative to debug module.

Installation

With npm...

npm install --save better-debug

Usage

var debug = require('better-debug')('main');

debug.log('Test'); // app:main:log Test
debug.info('Test %d', 0); // app:main:info Test 0
debug.warn(new Error('Test')); // app:main:warn { [Error: Test] }
debug.error(new Error('Test'), { method: 'testMethod', 'location': 'index.js', }); // app:main:error { [Error: Test] method: 'testMethod', location: 'index.js' }

You can filter everything with the env variable DEBUG. For example, DEBUG=app:*:info node . will only output debug.info calls.