mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
Add ability to log non-fatal errors (#3417)
This commit is contained in:
parent
adf7916a4c
commit
65237c18d7
3 changed files with 13 additions and 0 deletions
|
@ -11,4 +11,6 @@ class CrashLogsManagerImpl(
|
||||||
legacyAppCenterMigrator: LegacyAppCenterMigrator,
|
legacyAppCenterMigrator: LegacyAppCenterMigrator,
|
||||||
) : CrashLogsManager {
|
) : CrashLogsManager {
|
||||||
override var isEnabled: Boolean = true
|
override var isEnabled: Boolean = true
|
||||||
|
|
||||||
|
override fun trackNonFatalException(e: Exception) = Unit
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,9 @@ interface CrashLogsManager {
|
||||||
* Gets or sets whether the collection of crash logs is enabled.
|
* Gets or sets whether the collection of crash logs is enabled.
|
||||||
*/
|
*/
|
||||||
var isEnabled: Boolean
|
var isEnabled: Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks an exception if logs are enabled.
|
||||||
|
*/
|
||||||
|
fun trackNonFatalException(e: Exception)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,12 @@ class CrashLogsManagerImpl(
|
||||||
Firebase.crashlytics.setCrashlyticsCollectionEnabled(value)
|
Firebase.crashlytics.setCrashlyticsCollectionEnabled(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun trackNonFatalException(e: Exception) {
|
||||||
|
if (settingsRepository.isCrashLoggingEnabled) {
|
||||||
|
Firebase.crashlytics.recordException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
legacyAppCenterMigrator.migrateIfNecessary()
|
legacyAppCenterMigrator.migrateIfNecessary()
|
||||||
isEnabled = settingsRepository.isCrashLoggingEnabled
|
isEnabled = settingsRepository.isCrashLoggingEnabled
|
||||||
|
|
Loading…
Reference in a new issue