feat: add throwable support to Log.d/i and inline lambda overloads

- Add optional throwable parameter to d() and i() across all platforms
- Add inline lambda overloads for all log levels to defer message
  construction, avoiding string allocation when level is filtered
- Restore VoiceMessagePreview to pass throwable directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-03-28 11:19:06 +01:00
parent 250d89ca0a
commit 541b197a64
6 changed files with 71 additions and 9 deletions
@@ -50,14 +50,24 @@ actual object PlatformLog {
actual fun d(
tag: String,
message: String,
throwable: Throwable?,
) {
NSLog("DEBUG: [$tag] $message")
if (throwable != null) {
NSLog("DEBUG: [$tag] $message. Throwable: $throwable CAUSE ${throwable.cause}")
} else {
NSLog("DEBUG: [$tag] $message")
}
}
actual fun i(
tag: String,
message: String,
throwable: Throwable?,
) {
NSLog("INFO: [$tag] $message")
if (throwable != null) {
NSLog("INFO: [$tag] $message. Throwable: $throwable CAUSE ${throwable.cause}")
} else {
NSLog("INFO: [$tag] $message")
}
}
}