From 8cc7e05c9484900f01b8400a968c4edc9760f836 Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Fri, 15 Nov 2024 11:25:46 -0500 Subject: [PATCH] updating throwable calls --- .../src/appleMain/kotlin/co/touchlab/kermit/OSLogWriter.kt | 3 +-- .../appleMain/kotlin/co/touchlab/kermit/XcodeSeverityWriter.kt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/OSLogWriter.kt b/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/OSLogWriter.kt index a5306f7f..7aadaa8b 100644 --- a/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/OSLogWriter.kt +++ b/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/OSLogWriter.kt @@ -54,9 +54,8 @@ open class OSLogWriter internal constructor( } } - @OptIn(ExperimentalNativeApi::class) open fun logThrowable(osLogSeverity: os_log_type_t, throwable: Throwable) { - darwinLogger.log(osLogSeverity, throwable.getStackTrace().joinToString("\n")) + darwinLogger.log(osLogSeverity, throwable.stackTraceToString()) } private fun kermitSeverityToOsLogType(severity: Severity): os_log_type_t = when (severity) { diff --git a/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/XcodeSeverityWriter.kt b/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/XcodeSeverityWriter.kt index 67ba394d..dd872927 100644 --- a/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/XcodeSeverityWriter.kt +++ b/kermit-core/src/appleMain/kotlin/co/touchlab/kermit/XcodeSeverityWriter.kt @@ -22,10 +22,9 @@ open class XcodeSeverityWriter(private val messageStringFormatter: MessageString override fun formatMessage(severity: Severity, tag: Tag, message: Message): String = "${emojiPrefix(severity)} ${messageStringFormatter.formatMessage(null, tag, message)}" - @OptIn(ExperimentalNativeApi::class) override fun logThrowable(osLogSeverity: os_log_type_t, throwable: Throwable) { // oslog cuts off longer strings, so for local development, println is more useful - println(throwable.getStackTrace().joinToString("\n")) + println(throwable.stackTraceToString()) } //If this looks familiar, yes, it came directly from Napier :) https://github.com/AAkira/Napier#darwinios-macos-watchos-tvosintelapple-silicon