diff --git a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt index 9219683c3..1e25a050f 100644 --- a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt +++ b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/DefaultLogger.kt @@ -1,17 +1,15 @@ package org.mobilenativefoundation.store.store5.impl -import co.touchlab.kermit.CommonWriter import org.mobilenativefoundation.store.store5.Logger /** * Default implementation of [Logger] using the Kermit logging library. + * + * Derives a tagged logger from Kermit's global instance rather than reconfiguring it, so the host + * application's log writers and default tag are left untouched. */ internal class DefaultLogger : Logger { - private val delegate = - co.touchlab.kermit.Logger.apply { - setLogWriters(listOf(CommonWriter())) - setTag("Store") - } + private val delegate = co.touchlab.kermit.Logger.withTag("Store") override fun debug(message: String) { delegate.d(message) diff --git a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStore.kt b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStore.kt index 632f339c8..4e9a0b16a 100644 --- a/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStore.kt +++ b/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/impl/RealStore.kt @@ -15,7 +15,6 @@ */ package org.mobilenativefoundation.store.store5.impl -import co.touchlab.kermit.CommonWriter import co.touchlab.kermit.Logger import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope @@ -367,10 +366,8 @@ internal class RealStore( private fun fromMemCache(key: Key) = memCache?.getIfPresent(key) companion object { - private val logger = - Logger.apply { - setLogWriters(listOf(CommonWriter())) - setTag("Store") - } + // Derives a tagged logger instead of reconfiguring Kermit's global one, which would drop + // whatever log writers the host application installed. + private val logger = Logger.withTag("Store") } }