File tree Expand file tree Collapse file tree 7 files changed +26
-9
lines changed
src/commonMain/kotlin/net/thunderbird/core/logging/config
src/main/java/com/fsck/k9/preferences
quality/konsist/src/test/kotlin/net/thunderbird/quality Expand file tree Collapse file tree 7 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 1+ plugins {
2+ id(ThunderbirdPlugins .Library .kmp)
3+ }
4+
5+ android {
6+ namespace = " net.thunderbird.core.logging.config"
7+ }
8+
9+ kotlin {
10+ sourceSets {
11+ commonMain.dependencies {
12+ api(projects.core.logging.api)
13+ implementation(projects.core.logging.implComposite)
14+ implementation(projects.core.logging.implFile)
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1- package net.thunderbird.core.logging.legacy
1+ package net.thunderbird.core.logging.config
22
33import net.thunderbird.core.logging.composite.CompositeLogSink
44import net.thunderbird.core.logging.file.FileLogSink
5- import timber.log.Timber
6- import timber.log.Timber.DebugTree
75
8- // TODO: Implementation https://github.com/thunderbird/thunderbird-android/issues/9573
96class DebugLogConfigurator (
107 private val syncDebugCompositeSink : CompositeLogSink ,
118 private val syncDebugFileLogSink : FileLogSink ,
129) {
1310 fun updateLoggingStatus (isDebugLoggingEnabled : Boolean ) {
14- Timber .uprootAll ()
11+ syncDebugCompositeSink.manager.removeAll ()
1512 if (isDebugLoggingEnabled) {
16- Timber .plant(DebugTree ())
13+ syncDebugCompositeSink.manager.add(syncDebugCompositeSink)
14+ syncDebugCompositeSink.manager.add(syncDebugFileLogSink)
1715 }
1816 }
1917
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ dependencies {
1313 api(projects.core.preference.impl)
1414 api(projects.core.android.logging)
1515 api(projects.core.logging.implFile)
16+ api(projects.core.logging.config)
1617 api(projects.core.logging.implComposite)
1718 api(projects.core.android.network)
1819 api(projects.core.outcome)
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import kotlinx.coroutines.flow.stateIn
1313import kotlinx.coroutines.launch
1414import kotlinx.coroutines.sync.Mutex
1515import kotlinx.coroutines.sync.withLock
16- import net.thunderbird.core.logging.legacy .DebugLogConfigurator
16+ import net.thunderbird.core.logging.config .DebugLogConfigurator
1717import net.thunderbird.core.preference.GeneralSettings
1818import net.thunderbird.core.preference.GeneralSettingsManager
1919import net.thunderbird.core.preference.PreferenceChangePublisher
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package com.fsck.k9.preferences
33import com.fsck.k9.Preferences
44import kotlin.time.ExperimentalTime
55import net.thunderbird.core.android.account.LegacyAccountDtoManager
6- import net.thunderbird.core.logging.legacy .DebugLogConfigurator
6+ import net.thunderbird.core.logging.config .DebugLogConfigurator
77import net.thunderbird.core.preference.DefaultPreferenceChangeBroker
88import net.thunderbird.core.preference.GeneralSettingsManager
99import net.thunderbird.core.preference.PreferenceChangeBroker
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class ValidateLogger {
3030 .filterNot { it.hasNameMatching(" ConsoleLogSink.android|ConsoleLogSinkTest.android" .toRegex()) }
3131 .filterNot {
3232 // Exclude legacy code that still uses Timber
33- it.hasNameMatching(" LogFileWriter|FileLoggerTree|K9|DebugLogConfigurator " .toRegex())
33+ it.hasNameMatching(" LogFileWriter|FileLoggerTree|K9" .toRegex())
3434 }
3535 .assertFalse(
3636 additionalMessage = " No class should use timber.log.Timber import, use net.thunderbird.core.logging.Logger instead."
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ include(
153153 " :core:configstore:impl-backend" ,
154154 " :core:featureflag" ,
155155 " :core:logging:api" ,
156+ " :core:logging:config" ,
156157 " :core:logging:impl-composite" ,
157158 " :core:logging:impl-console" ,
158159 " :core:logging:impl-legacy" ,
You can’t perform that action at this time.
0 commit comments