
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
console-filterify
Advanced tools
Browserify transform that wraps all `console.*` calls in a filtering function that can be changed live directly in the browser.
Browserify transform that wraps all console.*
calls in a filtering function that can be changed live directly in the browser.
If console.filterify
is defined, it will be called with the console method (such as log
, warn
, error
, dir
) as first argument and the original console arguments as an array as the second argument.
This function is assumed to return either an array to log - possibly with manipulated values - or undefined to ignore logging this line at all.
If console.filterify
does not exist, the wrapper logs as usual.
The usual approach to filtering or coloring or decorating loggers are to have a wrapping library, which usually loses important information such as line and file name. This is not necessarily that much better, but offers a way to keep that kind of information as well as filter and/or manipulate the logging data dynamically on the way.
/**
* @param {string} level The log level such as log, warn error etc
* @param {array} args Array of original arguments
* @return {array} of arguments, possibly modified, or undefined to silence this log line
*/
console.filterify = function(level, args) {
if(['warn', 'error'].indexOf(level) > -1) {
return args;
}
return undefined;
}
// Add red CSS color to error log
console.filterify = function(level, args) {
if(level === 'error' && args.length > 0) {
args[0] = '%c' + args[0];
args.splice(1, 0, 'color:red');
}
return args;
}
FAQs
Browserify transform that wraps all `console.*` calls in a filtering function that can be changed live directly in the browser.
The npm package console-filterify receives a total of 1 weekly downloads. As such, console-filterify popularity was classified as not popular.
We found that console-filterify 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 researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.