Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: logger config #1017

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
package com.tari.android.wallet.infrastructure.logging

import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import com.tari.android.wallet.BuildConfig
import com.tari.android.wallet.data.WalletConfig
import com.tari.android.wallet.data.sharedPrefs.sentry.SentryPrefRepository
import javax.inject.Inject
import javax.inject.Singleton


@Singleton
class LoggerAdapter @Inject constructor(val walletConfig: WalletConfig, private val sentryPrefRepository: SentryPrefRepository) {
fun init() {
Logger.addLogAdapter(AndroidLogAdapter())
val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
.methodCount(2) // (Optional) How many method line to show. Default 2
.methodOffset(5) // (Optional) Hides internal method calls up to offset. Default 5
.tag("") // (Optional) Global tag for every log. Default PRETTY_LOGGER
.build()

Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
Logger.addLogAdapter(FFIFileAdapter())
@Suppress("KotlinConstantConditions")
if (BuildConfig.FLAVOR != "privacy") {
Expand Down