Implemented DefaultLoggerFactory to create platform specific logger

This commit is contained in:
dankito 2020-07-11 12:20:38 +02:00
parent 5083acc032
commit 2281d1758d
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,8 @@
package net.dankito.utils.multiplatform.log
expect class DefaultLoggerFactory() {
fun createDefaultLoggerFactory(): ILoggerFactory
}

View File

@ -7,7 +7,11 @@ class LoggerFactory {
companion object {
var loggerFactory: ILoggerFactory = LogToConsoleLoggerFactory()
var loggerFactory: ILoggerFactory = createDefaultLoggerFactory()
private fun createDefaultLoggerFactory(): ILoggerFactory {
return DefaultLoggerFactory().createDefaultLoggerFactory()
}
fun getLogger(name: String): Logger {

View File

@ -0,0 +1,10 @@
package net.dankito.utils.multiplatform.log
actual class DefaultLoggerFactory {
actual fun createDefaultLoggerFactory(): ILoggerFactory {
return NSLogLoggerFactory()
}
}