Skip to content

Commit

Permalink
fix: Use slf4j as log manager for jvm
Browse files Browse the repository at this point in the history
  • Loading branch information
enricocolasante committed Dec 17, 2024
1 parent e20d7b0 commit 0bd7191
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}

version = "3.2.0-SNAPSHOT"
version = "3.2.1-SNAPSHOT"
group = "org.hisp.dhis.rules"

if (project.hasProperty("removeSnapshotSuffix")) {
Expand Down Expand Up @@ -67,7 +67,11 @@ kotlin {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmMain by getting {
dependencies {
api("org.slf4j:slf4j-api:1.7.36")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,6 @@ internal class RuleConditionEvaluator {
}

companion object {
private val log = createLogger(RuleConditionEvaluator::class.simpleName!!)
private val log = createLogger("org.hisp.dhis.rules.engine.RuleConditionEvaluator")
}
}
6 changes: 4 additions & 2 deletions src/jvmMain/kotlin/org/hisp/dhis/rules/Logger.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.hisp.dhis.rules

import org.slf4j.LoggerFactory

actual fun createLogger(className: String): Logger{
val javaLogger = java.util.logging.Logger.getLogger(className)
return Logger({message -> javaLogger.severe(message)}, {message: String -> javaLogger.fine(message)})
val javaLogger = LoggerFactory.getLogger(className)
return Logger({message -> javaLogger.error(message)}, {message: String -> javaLogger.debug(message)})
}

0 comments on commit 0bd7191

Please sign in to comment.