new: extract logging module into standalone core library

This commit is contained in:
2026-06-19 17:35:12 +02:00
parent c4572eb042
commit 77a8ee645f
5 changed files with 54 additions and 4 deletions
+2 -4
View File
@@ -58,8 +58,9 @@ kotlin {
implementation(libs.compose.uiToolingPreview)
}
commonMain.dependencies {
// Audio player module
// Core modules
implementation(projects.core.audioplayer)
implementation(projects.core.logging)
implementation(libs.compose.runtime)
implementation(libs.compose.foundation)
@@ -69,9 +70,6 @@ kotlin {
implementation(libs.compose.components.resources)
implementation(libs.compose.uiToolingPreview)
// Logging
implementation(libs.kermit)
// Lifecycle
implementation(libs.lifecycle.viewmodelCompose)
implementation(libs.lifecycle.runtimeCompose)
@@ -1,26 +0,0 @@
package fr.ajaury.gwenedeg.core.logging
import co.touchlab.kermit.Logger as Kermit
/**
* Kermit-backed implementation (adapter) of the [Logger] port.
*/
class KermitLogger(
private val tag: String = "Gwenedeg",
) : Logger {
override fun debug(message: String, throwable: Throwable?) {
Kermit.d(throwable = throwable, tag = tag) { message }
}
override fun info(message: String, throwable: Throwable?) {
Kermit.i(throwable = throwable, tag = tag) { message }
}
override fun warning(message: String, throwable: Throwable?) {
Kermit.w(throwable = throwable, tag = tag) { message }
}
override fun error(message: String, throwable: Throwable?) {
Kermit.e(throwable = throwable, tag = tag) { message }
}
}
@@ -1,27 +0,0 @@
package fr.ajaury.gwenedeg.core.logging
/**
* Logging abstraction so the rest of the app depends on this interface
* rather than on a concrete logging library.
*/
interface Logger {
fun debug(
message: String,
throwable: Throwable? = null,
)
fun info(
message: String,
throwable: Throwable? = null,
)
fun warning(
message: String,
throwable: Throwable? = null,
)
fun error(
message: String,
throwable: Throwable? = null,
)
}