aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-11-16 03:57:32 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-11-16 04:02:09 +0530
commitb83cd841e8f2e8a2b0172ec4abab29cd64c97286 (patch)
tree11a8275e4ad621ea53de80a5e6cdf78199fe8a9d /app
parent480374d97468ecbd052d49883457c3d056aa4709 (diff)
feat: remove Beagle's logger integration
Fixes Sentry issue PASSWORD-STORE-GOOGLE-PLAY-14
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle.kts3
-rw-r--r--app/src/main/java/app/passwordstore/Application.kt19
-rw-r--r--app/src/main/java/app/passwordstore/util/log/ForwardingLogcatLogger.kt24
3 files changed, 3 insertions, 43 deletions
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 8d528540..92ed3b0d 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -104,12 +104,9 @@ dependencies {
if (snapshot.snapshot) {
implementation(libs.thirdparty.whatthestack)
implementation(libs.thirdparty.beagle.ui.drawer)
- implementation(libs.thirdparty.beagle.log)
} else {
debugImplementation(libs.thirdparty.beagle.ui.drawer)
- debugImplementation(libs.thirdparty.beagle.log)
releaseImplementation(libs.thirdparty.beagle.noop)
- releaseImplementation(libs.thirdparty.beagle.log.noop)
debugImplementation(libs.thirdparty.whatthestack)
}
diff --git a/app/src/main/java/app/passwordstore/Application.kt b/app/src/main/java/app/passwordstore/Application.kt
index 4737c088..997b8744 100644
--- a/app/src/main/java/app/passwordstore/Application.kt
+++ b/app/src/main/java/app/passwordstore/Application.kt
@@ -18,21 +18,17 @@ import app.passwordstore.util.extensions.getString
import app.passwordstore.util.features.Feature
import app.passwordstore.util.features.Features
import app.passwordstore.util.git.sshj.setUpBouncyCastleForSshj
-import app.passwordstore.util.log.ForwardingLogcatLogger
import app.passwordstore.util.proxy.ProxyUtils
import app.passwordstore.util.settings.GitSettings
import app.passwordstore.util.settings.PreferenceKeys
import app.passwordstore.util.settings.runMigrations
import com.google.android.material.color.DynamicColors
import com.pandulapeter.beagle.Beagle
-import com.pandulapeter.beagle.common.configuration.Behavior
-import com.pandulapeter.beagle.log.BeagleLogger
import com.pandulapeter.beagle.modules.AppInfoButtonModule
import com.pandulapeter.beagle.modules.DeviceInfoModule
import com.pandulapeter.beagle.modules.DividerModule
import com.pandulapeter.beagle.modules.HeaderModule
import com.pandulapeter.beagle.modules.LifecycleLogListModule
-import com.pandulapeter.beagle.modules.LogListModule
import com.pandulapeter.beagle.modules.PaddingModule
import com.pandulapeter.beagle.modules.ScreenCaptureToolboxModule
import dagger.hilt.android.HiltAndroidApp
@@ -40,6 +36,7 @@ import io.sentry.Sentry
import io.sentry.protocol.User
import java.util.concurrent.Executors
import javax.inject.Inject
+import logcat.AndroidLogcatLogger
import logcat.LogPriority.DEBUG
import logcat.LogPriority.VERBOSE
import logcat.LogcatLogger
@@ -62,16 +59,7 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
BuildConfig.ENABLE_DEBUG_FEATURES ||
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
) {
- Beagle.initialize(
- application = this,
- behavior =
- Behavior(
- logBehavior =
- Behavior.LogBehavior(
- loggers = listOf(BeagleLogger),
- )
- )
- )
+ Beagle.initialize(application = this)
Beagle.set(
HeaderModule(
title = getString(R.string.app_name),
@@ -83,12 +71,11 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
PaddingModule(),
ScreenCaptureToolboxModule(),
DividerModule(),
- LogListModule(),
LifecycleLogListModule(),
DividerModule(),
DeviceInfoModule(),
)
- LogcatLogger.install(ForwardingLogcatLogger(DEBUG))
+ LogcatLogger.install(AndroidLogcatLogger(DEBUG))
setVmPolicy()
}
prefs.registerOnSharedPreferenceChangeListener(this)
diff --git a/app/src/main/java/app/passwordstore/util/log/ForwardingLogcatLogger.kt b/app/src/main/java/app/passwordstore/util/log/ForwardingLogcatLogger.kt
deleted file mode 100644
index 15b2a0c7..00000000
--- a/app/src/main/java/app/passwordstore/util/log/ForwardingLogcatLogger.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package app.passwordstore.util.log
-
-import com.pandulapeter.beagle.log.BeagleLogger
-import logcat.AndroidLogcatLogger
-import logcat.LogPriority
-import logcat.LogPriority.DEBUG
-import logcat.LogcatLogger
-
-/**
- * Wrapper around [AndroidLogcatLogger] that ensures all logged messages are also forwarded to
- * [BeagleLogger].
- */
-class ForwardingLogcatLogger(minPriority: LogPriority = DEBUG) : LogcatLogger {
- private val androidLogger = AndroidLogcatLogger(minPriority)
-
- override fun isLoggable(priority: LogPriority): Boolean {
- return androidLogger.isLoggable(priority)
- }
-
- override fun log(priority: LogPriority, tag: String, message: String) {
- androidLogger.log(priority, tag, message)
- BeagleLogger.log(message = "[$tag]: $message", label = "Logcat", isPersisted = true)
- }
-}