noconsolejs

noconsolejs-icon

noconsolejs

npm version license npm


Tired of people judging you for leaving console.logs in production?

Yeah, me too.


Here’s why you absolutely need this

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.


Features (ahem, ahem)


Installation

For the Fancy Node.js Devs

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.


For my fellow ~Noobies~ Browser Folks

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>


Usage

Node.js Example

const disableConsole = require('noconsolejs');

// disabling all the bad decisions
disableConsole();

console.log("This? Never again.");
console.warn("No one will ever see your shame.");

Browser Example

<!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>


Will this Fix your Code?

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.