Implemented NSLogLogger and NSLogLoggerFactory
This commit is contained in:
parent
d50f458ef4
commit
5083acc032
|
@ -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")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package net.dankito.utils.multiplatform.log
|
||||||
|
|
||||||
|
|
||||||
|
open class NSLogLoggerFactory : ILoggerFactory {
|
||||||
|
|
||||||
|
override fun getLogger(name: String): Logger {
|
||||||
|
return NSLogLogger(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue