google/closure-compiler — pull request #737 by tntim96 (2014-12-08 09:26:47+00:00)
Title: Add compiler pass to remove console statements

There doesn't seem to be any non-intrusive way to remove 'console.log' statements from JavaScript source (for example see http://www.elijahmanor.com/grunt-away-those-pesky-console-log-statements/). Attached is a patch to try to achieve this via a compiler pass.

Note that it may throw an IllegalStateException if it detects that removal of the 'console.log' statement has any side-effects - this doesn't seem to be the right way to do this.

Any chance of working this into the compiler, and perhaps adding a specific command-line switch? Any feedback is welcome.