Yeah, me too.
Because your code is embarrassing. There, I said it. I mean, using console.log
to debug is fine when it’s just you and your code in the privacy of your local environment. But once it’s out there in the wild, it’s like leaving the house without your pants on. People will notice, and they will judge you. So save yourself the awkwardness and let noconsolejs sweep those logs under the rug, where they belong.
Most of us (aka everyone) use console.log
as if it’s the answer to all of life’s problems. But guess what? It’s not. It’s more like a ‘Post-It’ note you slapped on your code because you couldn’t figure out what went wrong.
Now, do you really want your users — or worse, your team — to see that? Yeah, didn’t think so.
node_modules
folder the size of a small planet. Plus, I didn’t need to add any, so — You’re Welcome.console.log
, console.warn
, console.error
, console.info
, console.debug
— and whatever else you thought was helping — gone; just like your dignity after debugging for 6 hours straight.You’re already running 20+ npm commands a day, what’s with one more anyway? Just run:
npm install noconsolejs
// noconsolejs
const disableConsole = require('noconsolejs');
disableConsole();
Boom. No more consoles. It’s like they never happened. No one will ever know you needed 39 logs to figure out how promises work.
Want this in the browser? Sure thing! Just drop this <script>
tag into your HTML, ideally in the <head>
. (You know, like putting your brain in the driver’s seat before making bad life choices. Same idea — keep things in the right place.)
<!-- noconsolejs -->
<script src="https://cdn.jsdelivr.net/gh/Druhin13/noconsolejs@master/index.js"></script>
const disableConsole = require('noconsolejs');
// disabling all the bad decisions
disableConsole();
console.log("This? Never again.");
console.warn("No one will ever see your shame.");
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>noconsolejs Example</title>
<!-- no more console shaming -->
<script src="https://cdn.jsdelivr.net/gh/Druhin13/noconsolejs@master/index.js"></script>
</head>
<body>
<script>
console.log("You'll never see this.");
console.error("Or this.");
</script>
</body>
</html>
Haha, No. Absolutely not. Your code is still a hot mess. But at least people won’t be able to tell from the console. It’s like sweeping everything under the rug, except no one trips over it. You’ll still need to actually fix your code at some point, but with noconsolejs, you can take your time. No one’s looking — for now, at least.
Yeah, yeah, it’s MIT. Do whatever you want with it. Just don’t blame me when your app breaks because you relied on console.log
to do all your debugging.