Deactivate any calls to Log before publishing: are there tools to do this?

Posted by Nicolas Raoul on Stack Overflow See other posts from Stack Overflow or by Nicolas Raoul
Published on 2010-03-15T10:00:28Z Indexed on 2010/03/17 23:31 UTC
Read the original article Hit count: 202

Filed under:
|
|

According to Google, I must "Deactivate any calls to Log methods in the source code" before publishing my Android app (section 4 of the publication checklist).

My open-source project is large and it is a pain to do it manually every time I release. Additionally, removing a Log line is potentially tricky, for instance:

if(condition)
  Log.d(LOG_TAG, "Something");
data.load();
data.show();

If I comment the Log line, then the condition applies to the next line, and chances are load() is not called. Are such situations rare enough that I can decide it should exist?

This is on the official checklist, so I guess many people do this on a regular basis.
So, is there a tool that removes all Log lines?
Preferably one that is not tricked by code like the above.

© Stack Overflow or respective owner

Related posts about android

Related posts about logging