Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
custom-log
Advanced tools
A tiny (~2kb) flexible logger, very basic, simple and fast. Will add some features over time.
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.
First install:
Browser:
<script src="./custom-log.min.js"></script>
Node:
npm install --save custom-log
<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 loaded in browser, for node use:
var customLog= require( 'custom-log' );
// create a single log function without prefix:
var log= customLog();
log( 'hey!' );
// hey!
// or create a log function with multiple custom log functions attached to it:
var log= customLog({
info : 'INFO: ',
warning : 'WARNING: ',
error : 'ERROR: ',
listener : 'LISTENER: ',
dal : 'DAL: '
// whateverNameYouMayNeed: 'whatever prefix message.. '
});
log( 'hello' );
// hello
log.info( 'easy!' );
// INFO: easy!
log.dal( 'Success! Payload: ', 'some payload' );
// DAL: Success! Payload: some payload
// now temporarily turn off dal messages:
log.dal.disable();
// and turn them on again:
log.dal.enable();
// disable or enable multiple levels at once
// arguments can be either (space seperated)String, Array of strings, multiple Strings
log.disable( 'dal listener error log' );
// or
log.enable( 'error', 'listener', 'log' );
// or
log.enable( ['error', 'listener', 'log'] );
0.2.3
0.2.1
changes license to MIT
0.1.9
Fixed bug that caused a crash on using the disable or enable function
0.1.6
Added log.assert function
0.1.0
Initial commit.
###license
MIT
FAQs
A tiny flexible logger
The npm package custom-log receives a total of 0 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.