Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 315b8985 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé Committed by GitHub
Browse files

Merge pull request #9816 from shamim-emon/fix-issue-9573

Decouple DebugLogConfigurator From Timber And Relocate to New Logger Infra
parents 7ddd47dc b55b2e39
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
plugins {
    id(ThunderbirdPlugins.Library.kmp)
}

android {
    namespace = "net.thunderbird.core.logging.config"
}

kotlin {
    sourceSets {
        commonMain.dependencies {
            api(projects.core.logging.api)
            implementation(projects.core.logging.implComposite)
            implementation(projects.core.logging.implFile)
        }
    }
}
+4 −6
Original line number Diff line number Diff line
package net.thunderbird.core.logging.legacy
package net.thunderbird.core.logging.config

import net.thunderbird.core.logging.composite.CompositeLogSink
import net.thunderbird.core.logging.file.FileLogSink
import timber.log.Timber
import timber.log.Timber.DebugTree

// TODO: Implementation https://github.com/thunderbird/thunderbird-android/issues/9573
class DebugLogConfigurator(
    private val syncDebugCompositeSink: CompositeLogSink,
    private val syncDebugFileLogSink: FileLogSink,
) {
    fun updateLoggingStatus(isDebugLoggingEnabled: Boolean) {
        Timber.uprootAll()
        syncDebugCompositeSink.manager.removeAll()
        if (isDebugLoggingEnabled) {
            Timber.plant(DebugTree())
            syncDebugCompositeSink.manager.add(syncDebugCompositeSink)
            syncDebugCompositeSink.manager.add(syncDebugFileLogSink)
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ dependencies {
    api(projects.core.preference.impl)
    api(projects.core.android.logging)
    api(projects.core.logging.implFile)
    api(projects.core.logging.config)
    api(projects.core.logging.implComposite)
    api(projects.core.android.network)
    api(projects.core.outcome)
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import net.thunderbird.core.logging.legacy.DebugLogConfigurator
import net.thunderbird.core.logging.config.DebugLogConfigurator
import net.thunderbird.core.preference.GeneralSettings
import net.thunderbird.core.preference.GeneralSettingsManager
import net.thunderbird.core.preference.PreferenceChangePublisher
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ package com.fsck.k9.preferences
import com.fsck.k9.Preferences
import kotlin.time.ExperimentalTime
import net.thunderbird.core.android.account.LegacyAccountDtoManager
import net.thunderbird.core.logging.legacy.DebugLogConfigurator
import net.thunderbird.core.logging.config.DebugLogConfigurator
import net.thunderbird.core.preference.DefaultPreferenceChangeBroker
import net.thunderbird.core.preference.GeneralSettingsManager
import net.thunderbird.core.preference.PreferenceChangeBroker
Loading