Joined June 2013
·

ADIO Kingsley O

Hextremelabs
·
Lagos
·
·
·

It is worth noting that >= INFO level logs shouldn't be disabled, even in production (except of course if explicitly stated), so an all encapsulating if (DEBUG_ON) { ... } block might not exactly be an ideal solution.
If one really wishes to disable >= INFO logs, you could probably just have a setLogLevel method and handle the value appropriately in the corresponding Log.x. Ideally, all less than relevant logging should be done at <= DEBUG levels.

Meanwhile, I would suggest taking advantage of the BuildConfig.DEBUG field instead, and you automatically get a managed DEBUG switch

Personally, I would just create a wrapper class, also named Log, preserving the relevant signatures from the actual android.util.Log. That way, the only change I will be making will be the import android.util.Log lines

@fathermerry yes, it works. I'm actually doing that myself :)

Now, this defines awesomeness! cool stuff

Achievements
180 Karma
8,527 Total ProTip Views