How to disable console.log for certain js file?

2

I have many console.log commands in a regras.js file. I would like to know if there is a way to disable% only in this file, since commenting on each console.log would be very time consuming, as there are many.

Notes:

I've already used this feature:

But it does not help me since it disables console.log of all files.

  

console.log = function () {}

    
asked by anonymous 06.04.2016 / 16:18

3 answers

3

Add to the end of your file regras.js the following line:

console.clear();

This will clear all% executed%. It can be a good solution if you do not want to or can not comment on all the lines.

    
06.04.2016 / 16:27
4

At the beginning of your file do:

var __log = console.log;
console.log = function() {};

And at the end of it restore console.log with:

console.log = __log;
    
06.04.2016 / 16:54
0

Programmatically, I do not know a way.

But using replace all of any IDE is possible. Search for console.log and replace with //console.log

    
06.04.2016 / 16:24