Removed CachedLoggerFactory as Kotlin/Native cannot cope with shared state of loggerCache Map
This commit is contained in:
parent
79a3080bbd
commit
588877cb20
|
@ -1,24 +0,0 @@
|
||||||
package net.dankito.utils.multiplatform.log
|
|
||||||
|
|
||||||
|
|
||||||
abstract class CachedLoggerFactory : ILoggerFactory {
|
|
||||||
|
|
||||||
abstract fun createLogger(name: String): Logger
|
|
||||||
|
|
||||||
|
|
||||||
protected open val loggerCache = mutableMapOf<String, Logger>() // TODO: make thread safe like with ConcurrentHashMap
|
|
||||||
|
|
||||||
|
|
||||||
override fun getLogger(name: String): Logger {
|
|
||||||
loggerCache[name]?.let {
|
|
||||||
return it
|
|
||||||
}
|
|
||||||
|
|
||||||
val logger = createLogger(name)
|
|
||||||
|
|
||||||
loggerCache[name] = logger
|
|
||||||
|
|
||||||
return logger
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,9 +1,9 @@
|
||||||
package net.dankito.utils.multiplatform.log
|
package net.dankito.utils.multiplatform.log
|
||||||
|
|
||||||
|
|
||||||
open class LogToConsoleLoggerFactory : CachedLoggerFactory() {
|
open class LogToConsoleLoggerFactory : ILoggerFactory {
|
||||||
|
|
||||||
override fun createLogger(name: String): Logger {
|
override fun getLogger(name: String): Logger {
|
||||||
return ConsoleLogger(name)
|
return ConsoleLogger(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ package net.dankito.utils.multiplatform.log
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
|
||||||
open class Slf4jLoggerFactory : CachedLoggerFactory() {
|
open class Slf4jLoggerFactory : ILoggerFactory {
|
||||||
|
|
||||||
override fun createLogger(name: String): Logger {
|
override fun getLogger(name: String): Logger {
|
||||||
return Slf4jLogger(LoggerFactory.getLogger(name))
|
return Slf4jLogger(LoggerFactory.getLogger(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue