re: Remove all console.log()s using Regex in Atom VIEW POST

re: Even better is to wrap all console.log()s into another method like this: if (debug) console.log(); This allows you to toggle logging based o...

Hey hey @ghost mind elaborating on your method? Is debug assuming it's an environment variable that puts the app in a certain state in which it console logs? I'm just unsure how this exactly works.

Thanks for your feedback :)


As per the example I included, usually you'd set the log level through an env variable. This would let you boot set a deployed app to debug / trace level without redploying.

As per:


In my example, debug is used for demonstration purposes as a placeholder for whatever condition you use to log.

For instance, let's say if the global variable debug is set to true, then the script in question should log as much as possible, else it shouldn't.

Full Disclosure: I am primarily a .NET developer and only have limited experience with JS.

code of conduct - report abuse