Skip to content

Commit

Permalink
change subsystem and category resolution based on #227
Browse files Browse the repository at this point in the history
  • Loading branch information
oshai committed Aug 8, 2023
1 parent 9511bc3 commit aecfeb8
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.oshai.kotlinlogging.internal
import io.github.oshai.kotlinlogging.DarwinKLogger
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KotlinLoggingConfiguration
import platform.darwin.OS_LOG_DEFAULT
import platform.darwin.os_log_create

/** factory methods to obtain a [KLogger] */
Expand All @@ -16,14 +17,15 @@ internal actual object KLoggerFactory {
subsystemConfigured != null || categoryConfigured != null -> {
DarwinKLogger(name, os_log_create(subsystemConfigured ?: name, categoryConfigured ?: name))
}
name.isBlank() -> DarwinKLogger(name, OS_LOG_DEFAULT)
name.contains(".") -> {
DarwinKLogger(
name,
os_log_create(name.substringBeforeLast("."), name.substringAfterLast("."))
)
}
else -> {
DarwinKLogger(name, os_log_create(name, "default"))
DarwinKLogger(name, os_log_create(name, ""))
}
}
}
Expand Down

0 comments on commit aecfeb8

Please sign in to comment.