Skip to content

Commit

Permalink
Improve naming and remove misleading JavaDoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeme Praks committed Oct 31, 2024
1 parent c0735bb commit 9c4160c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal actual object KLoggerFactory {
if (System.getProperty("kotlin-logging-to-jul") != null) {
return JulLoggerFactory.wrapJLogger(JulLoggerFactory.jLogger(name))
} else if (System.getProperty("kotlin-logging-to-logback") != null) {
return LogbackLoggerFactory.wrapJLogger(LogbackLoggerFactory.jLogger(name))
return LogbackLoggerFactory.wrapLogbackLogger(LogbackLoggerFactory.logbackLogger(name))
}
// default to slf4j
return Slf4jLoggerFactory.wrapJLogger(Slf4jLoggerFactory.jLogger(name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ internal object LogbackLoggerFactory {
return logbackServiceProvider
}

/** get a java logger by name. Logback relies on SLF4J logger factory */
internal fun jLogger(name: String): Logger =
/** Get a Logback logger by name. Logback relies on SLF4J logger factory */
internal fun logbackLogger(name: String): Logger =
logbackServiceProvider.loggerFactory.getLogger(name) as Logger

/** wrap java logger based on location awareness */
internal fun wrapJLogger(jLogger: Logger): KLogger =
LogbackLoggerWrapper(jLogger, logbackServiceProvider)
internal fun wrapLogbackLogger(logbackLogger: Logger): KLogger =
LogbackLoggerWrapper(logbackLogger, logbackServiceProvider)

fun getLoggerContext() = logbackServiceProvider.loggerFactory as LoggerContext
}

0 comments on commit 9c4160c

Please sign in to comment.