Implemented NSLogLogger and NSLogLoggerFactory

This commit is contained in:
dankito 2020-07-11 12:19:50 +02:00
parent d50f458ef4
commit 5083acc032
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package net.dankito.utils.multiplatform.log
import net.dankito.utils.multiplatform.Date
import net.dankito.utils.multiplatform.DateFormatter
import platform.Foundation.NSLog
open class NSLogLogger(name: String) : LoggerBase(name) {
companion object {
private val DateFormatter = DateFormatter("HH:mm:ss.SSS")
}
override fun log(level: LogLevel, message: String) {
NSLog("${DateFormatter.format(Date())} $level $name - $message")
}
}

View File

@ -0,0 +1,10 @@
package net.dankito.utils.multiplatform.log
open class NSLogLoggerFactory : ILoggerFactory {
override fun getLogger(name: String): Logger {
return NSLogLogger(name)
}
}