Updated on 2026-08-14
This commit is contained in:
parent
842b3e494a
commit
e01127186c
14 changed files with 128 additions and 131 deletions
|
|
@ -3,19 +3,19 @@ package com.tangem.tap.common.log
|
|||
import android.util.Log
|
||||
import com.orhanobut.logger.AndroidLogAdapter
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tangem.domain.settings.repositories.SettingsRepository
|
||||
import com.tangem.datasource.local.logs.AppLogsStore
|
||||
import com.tangem.wallet.BuildConfig
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Tangem app logger
|
||||
*
|
||||
* @property settingsRepository repository for saving logs
|
||||
* @property appLogsStore app logs store
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class TangemAppLoggerInitializer(
|
||||
private val settingsRepository: SettingsRepository,
|
||||
private val appLogsStore: AppLogsStore,
|
||||
) {
|
||||
|
||||
/** Initialize */
|
||||
|
|
@ -35,7 +35,7 @@ class TangemAppLoggerInitializer(
|
|||
}
|
||||
|
||||
if (PERMITTED_PRIORITY.contains(priority)) {
|
||||
settingsRepository.saveLogMessage(message)
|
||||
appLogsStore.saveLogMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,26 +3,26 @@ package com.tangem.tap.common.log
|
|||
import com.tangem.Log
|
||||
import com.tangem.LogFormat
|
||||
import com.tangem.TangemSdkLogger
|
||||
import com.tangem.domain.settings.repositories.SettingsRepository
|
||||
import com.tangem.datasource.local.logs.AppLogsStore
|
||||
|
||||
/**
|
||||
* CardSDK logger implementation
|
||||
*
|
||||
* @property levels logging levels
|
||||
* @property messageFormatter message formatter
|
||||
* @property settingsRepository settings repository
|
||||
* @property levels logging levels
|
||||
* @property messageFormatter message formatter
|
||||
* @property appLogsStore app logs store
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal class TangemCardSDKLogger(
|
||||
private val levels: List<Log.Level>,
|
||||
private val messageFormatter: LogFormat,
|
||||
private val settingsRepository: SettingsRepository,
|
||||
private val appLogsStore: AppLogsStore,
|
||||
) : TangemSdkLogger {
|
||||
|
||||
override fun log(message: () -> String, level: Log.Level) {
|
||||
if (!levels.contains(level)) return
|
||||
|
||||
settingsRepository.saveLogMessage(message = messageFormatter.format(message, level))
|
||||
appLogsStore.saveLogMessage(message = messageFormatter.format(message, level))
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import timber.log.Timber
|
|||
val logMiddleware: Middleware<AppState> = { _, _ ->
|
||||
{ nextDispatch ->
|
||||
{ action ->
|
||||
Timber.i("Dispatch action: $action")
|
||||
Timber.i("Dispatch action: ${action::class.java.simpleName}")
|
||||
nextDispatch(action)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue