Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use slf4j logger #136

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ kotlin {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmMain by getting {
dependencies {
implementation("org.slf4j:slf4j-api:1.7.36")
}
}
val jvmTest by getting
val jsMain by getting
val jsTest by getting
Expand Down
4 changes: 2 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,6 @@
package org.hisp.dhis.rules

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 = org.slf4j.LoggerFactory.getLogger(className)
return Logger({message -> javaLogger.error(message)}, {message: String -> javaLogger.debug(message)})
}