diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index f5f9854..6346446 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -52,6 +52,7 @@ kotlin { implementation(libs.precompose.navigation) implementation(libs.precompose.viewmodel) implementation(libs.precompose.koin) + implementation(libs.kermit) implementation(libs.koin.core) implementation(libs.multiplatform.settings) implementation(libs.sqldelight.runtime) diff --git a/composeApp/src/commonMain/kotlin/data/datasource/local/LocalBalanceDataSource.kt b/composeApp/src/commonMain/kotlin/data/datasource/local/LocalBalanceDataSource.kt index 0dd2af1..ea78746 100644 --- a/composeApp/src/commonMain/kotlin/data/datasource/local/LocalBalanceDataSource.kt +++ b/composeApp/src/commonMain/kotlin/data/datasource/local/LocalBalanceDataSource.kt @@ -1,5 +1,6 @@ package data.datasource.local +import co.touchlab.kermit.Logger import com.russhwolf.settings.Settings import com.russhwolf.settings.set import data.datasource.BalanceDataSource @@ -10,6 +11,7 @@ import kotlinx.coroutines.withContext class LocalBalanceDataSource : BalanceDataSource { private val settings: Settings = Settings() + private val log = Logger.withTag(this::class.simpleName ?: "LocalBalanceDataSource") override suspend fun getUsersBalance(): Balance = withContext(Dispatchers.IO) { val usersBalance: String = settings.getString(BALANCE_KEY, BALANCE_DEFAULT_VALUE) @@ -18,6 +20,7 @@ class LocalBalanceDataSource : BalanceDataSource { override suspend fun updateUsersBalance(balance: Balance) = withContext(Dispatchers.IO) { settings[BALANCE_KEY] = balance.toString() + log.i("Update users balance: $balance") } companion object { diff --git a/composeApp/src/commonMain/kotlin/data/datasource/local/LocalOperationDataSource.kt b/composeApp/src/commonMain/kotlin/data/datasource/local/LocalOperationDataSource.kt index d2ec373..c103b42 100644 --- a/composeApp/src/commonMain/kotlin/data/datasource/local/LocalOperationDataSource.kt +++ b/composeApp/src/commonMain/kotlin/data/datasource/local/LocalOperationDataSource.kt @@ -1,5 +1,6 @@ package data.datasource.local +import co.touchlab.kermit.Logger import com.github.guibrisson.db.MoneyMateDatabase import data.datasource.OperationDataSource import domain.model.Category @@ -12,6 +13,7 @@ import org.koin.core.component.inject class LocalOperationDataSource: KoinComponent, OperationDataSource { private val databaseWrapper: DatabaseWrapper by inject() private val database: MoneyMateDatabase = databaseWrapper.instance() + private val log = Logger.withTag(this::class.simpleName ?: "LocalOperationDataSource") override suspend fun getById(id: Int): Result { //TODO remove this later, mocked for now diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 345d2a5..55bade8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,6 +10,7 @@ androidx-test-junit = "1.1.5" compose = "1.6.2" compose-plugin = "1.6.0" junit = "4.13.2" +kermit = "2.0.3" kotlin = "1.9.22" kotlinx-datetime = "0.6.0-RC.2" koin = "3.5.3" @@ -27,6 +28,7 @@ androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-co androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } +kermit = { group = "co.touchlab", name = "kermit", version.ref = "kermit" } koin-core = { group = "io.insert-koin", name = "koin-core", version.ref = "koin" } koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" } kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }