Skip to content

Commit 6a67a6f

Browse files
committed
Fix Darwin historical logs redaction using public format string
os_log redacts dynamic strings by default in historical logs (viewed via log show) for privacy. This change updates DarwinKLogger to use %{public}s as the fixed format string and passes the message as an argument, explicitly marking it as public data to prevent redaction. Fixes #588
1 parent aa51a0d commit 6a67a6f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/darwinMain/kotlin/io/github/oshai/kotlinlogging/DarwinKLogger.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public class DarwinKLogger(override val name: String, override val underlyingLog
2626
__dso_handle.ptr,
2727
underlyingLogger,
2828
level.toDarwinLevel(),
29+
// Use %{public}s to prevent redaction of the log message in historical logs (log show)
30+
// See https://github.com/oshai/kotlin-logging/issues/588
31+
"%{public}s",
2932
formattedMessage,
3033
)
3134
}

0 commit comments

Comments
 (0)