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 SLF4J logger #1954

Merged
merged 1 commit into from
Aug 27, 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
4 changes: 2 additions & 2 deletions examples/gradle/versions.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext {
// Kotlin
kotlin_version = '2.0.0'
kotlin_version = '2.0.20'
// Koin Versions
koin_version = '4.0.0-RC1'
koin_version = '4.0.0-RC2'
koin_android_version = koin_version
koin_compose_version = koin_version

Expand Down
3 changes: 2 additions & 1 deletion examples/hello-ktor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ dependencies {

implementation "io.insert-koin:koin-ktor:$koin_version"
implementation "io.insert-koin:koin-logger-slf4j:$koin_version"
implementation "ch.qos.logback:logback-classic:1.2.11"
implementation("org.slf4j:slf4j-api:2.0.13") // Adjust version as needed
implementation "ch.qos.logback:logback-classic:1.5.6"

testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "io.ktor:ktor-server-test-host:$ktor_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fun main(args: Array<String>) {
fun Application.mainModule() {
install(CallLogging)
install(Koin) {
printLogger(Level.DEBUG)
slf4jLogger(Level.INFO)
modules(appModule)
}

Expand Down
9 changes: 3 additions & 6 deletions examples/hello-ktor/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<root level="trace">
<appender-ref ref="STDOUT"/>
<root level="info">
<appender-ref ref="STDOUT" />
</root>

<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="io.netty" level="INFO"/>

</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SLF4JLogger(level: Level = Level.INFO) : Logger(level) {
private val logger = LoggerFactory.getLogger(KOIN_TAG)

override fun display(level: Level, msg: MESSAGE) {
when (this.level) {
when (level) {
Level.DEBUG -> logger.debug(msg)
Level.INFO -> logger.info(msg)
Level.ERROR -> logger.error(msg)
Expand Down
Loading