custom-log
A tiny (~2kb) flexible logger, very basic, simple and fast. Will add some features over time.
For browser, node, amd.
custom-log is targeted at the Browser as a tiny helper that makes available any custom log function you can
create yourself, and which can be enabled/disabled individually.
Although there are plenty full-fledged loggers for use in node, you can use this one instead if you don't
need a zillion features, but rather prefer simplicity.
How to use?
<function> customLog( <string>/<object> init )
Returns a log function based on the init argument. The init argument can be either a string or an object.
If init is a string, only the base log function's prefix can be set with a string. In case init is an
object, multiple custom log functions with their own prefix strings can be defined in the init object.
To set the base log function prefix in a init object, use the reserved 'log' key. See some examples below:
var customLog= require( 'custom-log' );
var log= customLog( 'LOG: ' );
log( 'hey!' );
var log= customLog({
log : 'LOG: ',
info : 'INFO: ',
warning : 'WARNING: ',
error : 'ERROR: ',
listener : 'LISTENER: ',
dal : 'DAL: '
});
log( 'hello' );
log.info( 'easy!' );
log.dal( 'Success! Payload: ', 'some payload' );
log.dal.disable();
log.dal.enable();
change log
0.1.0
Initial commit.