diff --git a/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLogger.kt b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLogger.kt new file mode 100644 index 00000000..21ea843f --- /dev/null +++ b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLogger.kt @@ -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") + } + +} \ No newline at end of file diff --git a/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLoggerFactory.kt b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLoggerFactory.kt new file mode 100644 index 00000000..81a82704 --- /dev/null +++ b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/log/NSLogLoggerFactory.kt @@ -0,0 +1,10 @@ +package net.dankito.utils.multiplatform.log + + +open class NSLogLoggerFactory : ILoggerFactory { + + override fun getLogger(name: String): Logger { + return NSLogLogger(name) + } + +} \ No newline at end of file