30

Getting ready for production.

Search: console.log
Replace: //console.log
Search: ////console.log
Replace: //console.log

...

Aaaaaand we're good.

Comments
  • 6
    I think I'm forgetting something...

    If you forgot it's probably not that important...

    console.error: (-_-)
  • 2
    Do you have logs that are not on a new line? If not, you can skip the second step and just search for "\w?console.log".
  • 0
  • 4
    I use a logger framework with log levels so I don't have to do this.
  • 2
    @coffeeholic Oh, well if we get frameworks or process managers then I won't even bother to comment them...

    pm2 start app.js --log /dev/null/
  • 1
    if you are a js dev, you can create an env file and do some flags or whatever you want to write about your logs. E.g.

    window.__env.enableDebug = false;

    and in your main.js you can do it like this

    if (!env.enableDebug) {

    window.console.log = function () { };

    }
  • 0
    @kjing It's possible, but not ideal. What if you're working on something that won't be alone in the global scope, i.e. an embeddable app/widget/something? You touch something in window and affect not only your app, but everything else too.
  • 0
    U actually to that ?
    I’d be afraid of

    console.log(
    ‘Look, a new line’
    );
Add Comment