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.
Safe, clear console logging for every browser
Log to the console — even legacy browsers without a console. Just pass any data to log()
and you'll see it printed clearly and well-structured in the console.
If the browser doesn't have a console, Firebug Lite will load. You can pass any variable type: strings, objects, arrays, functions, etc.
Demo: patik.github.io/console.log-wrapper
npm: npm install consolelog
Bower: bower install consolelog
Or just download consolelog.js and reference it in your page with a <script>
tag.
Use log()
wherever you want to write to the console.
Consolelog.js is AMD-compliant and supports Common JS:
require(['consolelog'], function(log) {
log('It works!');
});
You can change some optional preferences by passing an object to log.settings()
. The defaults are shown below.
log.settings({
lineNumber: true,
group: {
label: 'Log:',
collapsed: false
}
});
lineNumber
(Boolean)
group
(Boolean or object)
collapsed: true
will collapse each group (in browsers that support collapsing)label: "some string"
sets the label or name for the groupsgroup: true
is a shorthand way of selecting the defaultsThis is an optional plugin to provide help information about the data that is being logged, especially in IE and older browsers. Just include consolelog.detailprint.js along with consolelog.js.
Firebug, WebKit's Developer Tools, and Opera's Dragonfly print useful, interactive items to the console. For example:
console.log(
"Here's a string",
3.14,
{"alpha": 5, "bravo": false},
document.getElementById('charlie'),
new Date()
);
Results in:
Some browsers that have a primitive console — one that does not expand arrays, does not link DOM elements to the source code, only prints objects as [object Object]
rather than listing their properties, etc.
Some cannot accept multiple arguments to a single console.log
call. This includes IE 7/8/9/10, iOS 5 and older, and Opera 11 and older, among others.
Using the detailPrint
companion plugin, special objects are presented in a more readable manner.
patik.github.io/console.log-wrapper
patik.com/blog/complete-cross-browser-console-log
Console.log-wrapper is released under three licenses: MIT, BSD, and GPL.
FAQs
Cross-Browser console.log() Wrapper
The npm package consolelog receives a total of 21 weekly downloads. As such, consolelog popularity was classified as not popular.
We found that consolelog 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.