how to Stop console.log on and off in your web application?


Below solution is uses AngularJS but you can apply this to jquery application easily as well.

Solution:

console.log = function() {}; //KILL ALL CONSOLE.lOGs

 

/* Note

If above line is uncommented, then you won’t see any console.logs. If you want logs back on , then comment line.

*/

e.g.  Another Example :

console.log(‘Line 1’);

console.log(‘Line 2’);

console.log = function() {};

console.log(‘Line 3’);

Output :

Line 1

Line 2

Hope this will help developers out there Smile 

Happy coding…!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s