I was surprised to learn that one has to enclose an android logging statement in an
if(DEBUG) {
Slog.d(...);
}
see https://stackoverflow.com/a/2020964/398348
It is cumbersome.
In the android documentation, it seems to say that one does not have to - the api seems similar to log4j where the log level is configured via external means using a properties file, and only logs above the log level are output.
I would have expected that the implementation of Log.d()
would have the if()
inside it, so that the developer does not have to enclose it.
class Log {
void d() {
if(DEBUG) {....}
}
...
}
Can someone please clarify?
Note: I do not wish to use proguard as mentioned in several places.