README
Verbosed
Simple verbosity control for any loggers
This is a simple wrapper for methods of the console
or the Your Favorite Logger.
Verbosed
can help you to control verbosity of your modules in the Node and the browsers.
Install
npm install verbosed
Use
var verbosed = require('verbosed');
var console = verbosed.create('my-module');
console.time('some times');
console.log('some useful logs here');
console.error('some errors');
console.timeEnd('some times');
By default all logs is disabled. But if you run node with VERBOSE
you see it:
VERBOSE=true node app # see all logs
VERBOSE=my-module,other-module node app # see especial logs
or change verbosed modules on the fly:
var verbosed = require('verbosed');
verbosed(['my-module', 'other-module']); // show especial modules
verbosed(false); // hide all logs;
If you change verbosed()
modules from browser console or runtime then
list of modules will be saved to localStorage
to log even after page reaload.
Your Favorite Logger
You can use custom logger instead default console.log
. Also you can setup your
own methods to decorate it:
var verbosed = require('verbosed');
verbosed.logger = require('util'); // or Your Favorite Logger
verbosed.methods = ['marsAttacks', 'megaError', 'sendSMS', 'ChuckNorrisError']; // or any methods
var logger = verbosed.create('my-module')
Browser
The module can work with browser. You can pass list verbose modules to window.verbosed()
:
verbosed(true); // all logs
verbosed(['my-module', 'other-module']); // especial logs
var console = verbosed.create('my-setup');
Local Storage
Module save verbosed list to localStorage
key automatically. I mean that
you don't need to setup verbosed modules every time when you reload your page.
It just save the value for you :D
Filtering
You can filter logs by devtools filter in the browsers.
Build for browser
You can get current version of verbosed
in the dest/
, but if you want to compile,
to hack, or to debug verbosed
that you can just run follow script:
npm run make
The script just compile current version of the module to dest/verbosed.js
by
browserify index.js -s verbosed > ./dest/verbosed.js
.