Ensure logger is installed when requested (#1549)

This commit is contained in:
Harsh Shandilya
2021-11-23 20:31:55 +05:30
committed by GitHub
parent d7bbdce1c0
commit d129d5e580

View File

@@ -25,6 +25,8 @@ import dev.msfjarvis.aps.util.settings.PreferenceKeys
import dev.msfjarvis.aps.util.settings.runMigrations
import javax.inject.Inject
import logcat.AndroidLogcatLogger
import logcat.LogPriority.DEBUG
import logcat.LogcatLogger
@Suppress("Unused")
@HiltAndroidApp
@@ -41,7 +43,7 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
if (BuildConfig.ENABLE_DEBUG_FEATURES ||
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
) {
AndroidLogcatLogger.installOnDebuggableApp(this)
LogcatLogger.install(AndroidLogcatLogger(DEBUG))
StrictMode.setVmPolicy(VmPolicy.Builder().detectAll().penaltyLog().build())
StrictMode.setThreadPolicy(ThreadPolicy.Builder().detectAll().penaltyLog().build())
}