[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/1083. Don't print sensitive data to logs in the production app. (https://github.com/mozilla-mobile/fenix/pull/2437)
parent
7c3da988a2
commit
521001ea05
@ -0,0 +1,44 @@
|
||||
package org.mozilla.fenix.ext
|
||||
|
||||
import android.util.Log
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
|
||||
/**
|
||||
* Will print to `Log.d()` only when [BuildConfig.DEBUG] is enabled.
|
||||
*
|
||||
* Meant to be used for logs that should not be visible in the production app.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun logDebug(tag: String, message: String) {
|
||||
if (BuildConfig.DEBUG) Log.d(tag, message)
|
||||
}
|
||||
|
||||
/**
|
||||
* Will print to `Log.w()` only when [BuildConfig.DEBUG] is enabled.
|
||||
*
|
||||
* Meant to be used for logs that should not be visible in the production app.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun logWarn(tag: String, message: String) {
|
||||
if (BuildConfig.DEBUG) Log.w(tag, message)
|
||||
}
|
||||
|
||||
/**
|
||||
* Will print to `Log.w()` only when [BuildConfig.DEBUG] is enabled.
|
||||
*
|
||||
* Meant to be used for logs that should not be visible in the production app.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun logWarn(tag: String, message: String, err: Throwable) {
|
||||
if (BuildConfig.DEBUG) Log.w(tag, message, err)
|
||||
}
|
||||
|
||||
/**
|
||||
* Will print to `Log.e()` only when [BuildConfig.DEBUG] is enabled.
|
||||
*
|
||||
* Meant to be used for logs that should not be visible in the production app.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun logErr(tag: String, message: String, err: Throwable) {
|
||||
if (BuildConfig.DEBUG) Log.e(tag, message, err)
|
||||
}
|
Loading…
Reference in New Issue