Skip to content
Open
Show file tree
Hide file tree
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,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -367,10 +366,8 @@ internal class RealStore<Key : Any, Network : Any, Output : Any, Local : Any>(
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")
}
}