debug-fabulous
Install
npm install --save debug-fabulous
Purpose:
Wrapper / Extension around visionmedia's debug to allow lazy evaluation of debugging via closure handling.
Why would I consider using this library?
One on the main utilities added to this library is lazy log level evaluation. This allows whatever log strings to only be created and evaluated if a log level is active. This can considerably reduce the amount of memory used in logging when you are not using.
This is important as this results in no-excuse for not using logging in your applications for performance reasons.
Proof
For analysis of the performance results are in perfWith.out and perfWithout.out.
In summary, the tests using this library are using 3 times less memory for the same logging statements (when the log levels are disabled).
This library essentially wraps two things:
- lazy-eval: debug closure handling
- spawn: spawns off existing namespaces for a sub namespace.
Example:
For usage see the tests or the example below.
var debug = require('')();
debug = debug('namespace');
debug(function(){return 'something to log' + someLargeHarryString;});
debug(() => 'something to log ${someLargeHarryString}');
debug('small out');
var childDbg = debug.spawn('child');
childDbg('small out');
var grandChildDbg = debug.spawn('grandChild');
grandChildDbg('small out');