
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
custom-log
Advanced tools
A tiny (~1kb) 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.
<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:
// customLog is global when load in browser
// but in node:
var customLog= require( 'custom-log' );
// create a single log function with prefix:
var log= customLog( 'LOG: ' );
log( 'hey!' );
// LOG: hey!
// or create a log function with multiple custom log functions attached to it:
var log= customLog({
// when omitting log, no prefix for the default log function will be used
log : 'LOG: ',
info : 'INFO: ',
warning : 'WARNING: ',
error : 'ERROR: ',
listener : 'LISTENER: ',
dal : 'DAL: '
// whateverNameYouMayNeed: 'whatever prefix message.. '
});
log( 'hello' );
// LOG: hello
log.info( 'easy!' );
// INFO: easy!
log.dal( 'Success! Payload: ', 'some payload' );
// DAL: Success! Payload: some payload
// now turn of dal messages:
log.dal.disable();
// or turn them on again:
log.dal.enable();
0.1.0
Initial commit.
FAQs
A tiny flexible logger
The npm package custom-log receives a total of 2 weekly downloads. As such, custom-log popularity was classified as not popular.
We found that custom-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.