Inspectopedia Help

Unconditional Logging Calls

Unconditional Logging Calls

The BuildConfig class provides a constant, DEBUG, which indicates whether the code is being built in release mode or in debug mode. In release mode, you typically want to strip out all the logging calls. Since the compiler will automatically remove all code which is inside a if (false) check, surrounding your logging calls with a check for BuildConfig.DEBUG is a good idea.

If you really intend for the logging to be present in release mode, you can suppress this warning with a @SuppressLint annotation for the intentional logging calls.

Issue id: LogConditional

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3


Android, 2022.3.1 Beta 2

Last modified: 13 July 2023