From 7b8d5cb244cd6e8a0178bb6d404445c0d9d9088b Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Thu, 5 Sep 2024 20:16:10 +0200 Subject: [PATCH] Change logger --- .../kotlin/ch/dissem/yaep/domain/GameTest.kt | 25 ++++++++++--------- gradle/libs.versions.toml | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/domain/src/commonTest/kotlin/ch/dissem/yaep/domain/GameTest.kt b/domain/src/commonTest/kotlin/ch/dissem/yaep/domain/GameTest.kt index 270382e..112ad68 100644 --- a/domain/src/commonTest/kotlin/ch/dissem/yaep/domain/GameTest.kt +++ b/domain/src/commonTest/kotlin/ch/dissem/yaep/domain/GameTest.kt @@ -9,12 +9,13 @@ import ch.tutteli.atrium.api.fluent.en_GB.toBeGreaterThan import ch.tutteli.atrium.api.fluent.en_GB.toBeLessThan import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.verbs.expect -import co.touchlab.kermit.Logger +import io.github.oshai.kotlinlogging.KotlinLogging import kotlin.test.Test import kotlin.time.Duration.Companion.milliseconds import kotlin.time.measureTime class GameTest { + private val log = KotlinLogging.logger {} @Test fun `ensure generated games are solvable`() { @@ -30,10 +31,10 @@ class GameTest { val time = measureTime { game = generateGame() } - Logger.i { "Generated game #$i in ${time.inWholeMilliseconds}ms" } + log.info { "Generated game #$i in ${time.inWholeMilliseconds}ms" } val solvable = solve(game.grid, game.clues) if (solvable != SOLVABLE) { - Logger.i { "Puzzle:\n$game" } + log.info { "Puzzle:\n$game" } } expect(solvable).toEqual(SOLVABLE) expect(time).toBeLessThan(500.milliseconds) @@ -53,13 +54,13 @@ class GameTest { totalClues += game.clues.size } - Logger.i { "Slowest: $slowest" } - Logger.i { "Fastest: $fastest" } - Logger.i { "Average: ${total / tries}" } - Logger.i { "Clues:" } - Logger.i { "Most: $most" } - Logger.i { "Least: $least" } - Logger.i { "Average: ${totalClues / tries}" } + log.info { "Slowest: $slowest" } + log.info { "Fastest: $fastest" } + log.info { "Average: ${total / tries}" } + log.info { "Clues:" } + log.info { "Most: $most" } + log.info { "Least: $least" } + log.info { "Average: ${totalClues / tries}" } } @Test @@ -76,8 +77,8 @@ class GameTest { feature(Collection::size).toBeLessThan(30) } } - Logger.i{"Clues: ${game.clues.size}"} - Logger.i{"Time: $time"} + log.info{"Clues: ${game.clues.size}"} + log.info{"Time: $time"} expect(solve(game.grid, game.clues)).toEqual(SOLVABLE) expect(time).toBeLessThan(500.milliseconds) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6ca4730..3bb62b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ androidx-compose-foundation = { module = "androidx.compose.foundation:foundation kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } atrium = { module = "ch.tutteli.atrium:atrium-fluent", version.ref = "atrium" } androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } -logging = { module = "co.touchlab:kermit", version = "2.0.4" } +logging = { module = "io.github.oshai:kotlin-logging", version = "7.0.0" } [plugins] versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }