0

Is there a way to have non intrusive logs in Android ?, for example, if I have a method like the following one:

public void aMedthod() {
    doSmt();
    if (mSomeState) {
        if (doSmtElse()) {
            Log.v("MyApp","Success")
        }
    }    
}

What I'd like to do is replacing that Log line with something as less intrusive as possible, in order to package the app for production without any trace of the Log library and at the same time, not having to delete nor comment any piece of code.

RobertoAllende
  • 8,744
  • 4
  • 30
  • 49

1 Answers1

1

Jake Wharton made an awesome library that can accomplish exactly that. Take a look here.

just use this to init:

if (BuildConfig.DEBUG) {
    Timber.plant(new Timber.DebugTree());
}
Natan
  • 1,867
  • 13
  • 24
  • Thank you very much, I'm not surprised Jake solved it already. I took a look at the library and it's not very clear how the nonintrusive part is being addressed. Could elaborate or share a document on this ? – RobertoAllende May 17 '16 at 18:04