DEV Community

Discussion on: Remove all console.log()s using Regex in Atom

Collapse
 
michael profile image
Michael Lee 🍕

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 :)

Collapse
 
ghost profile image
Ghost

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.

Thread Thread
 
michael profile image
Michael Lee 🍕

Gotcha, thanks David for elaborating :)

Collapse
 
joegaudet profile image
Joe Gaudet

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: 12factor.net/config