Kermit icon indicating copy to clipboard operation
Kermit copied to clipboard

OSLogWriter not working properly

Open robbiehanson opened this issue 2 years ago • 2 comments

As mentioned in issue #339, the OSLogWriter doesn't work properly. In particular, it doesn't properly send messages to the OSLog system, and as such, the messages get corrupted within the OSLogStore.

It seems the source of the problem is the use of an internal API: _os_log_internal. Replacing this with a call to the public API os_log_with_type fixes the problem.

However, the standard os_log functions (the public API's that Apple tells you to use) are mysteriously missing from the kotlin-generated headers. So to get around this problem I used a cInterop file.

robbiehanson avatar Oct 16 '23 20:10 robbiehanson

I've tried this PR locally and I am now able to obtain logs from the oslog on an end-user device with no xcode attached via pymobiledevice3 e.g.:

pymobiledevice3 developer dvt oslog

The logs show up as <private> though, I guess because of https://github.com/touchlab/Kermit/issues/400.

The solution appears to be to change https://github.com/touchlab/Kermit/pull/381/files#diff-e77742a050dfd9cbf9a8cfc531a2f144dcb4c34f2b2064a2b3a3925e872d7fd3R20 to be %{public}s instead of %s.

Do you plan to rebase this PR @robbiehanson ? If not, I can take it over.

rocketraman avatar Oct 16 '24 16:10 rocketraman

The logs show up as though, I guess because of https://github.com/touchlab/Kermit/issues/400.

Update: I've installed this PR along with the change mentioned in #400 to use %{public}s and things work immensely better. I can even view the logs of an iPhone device via pymobiledevice3 syslog live from a Linux box!

Would love it if some attention was paid to this PR as well as the change suggested by the reporter of #400 . If it would help @kpgalligan I can submit an updated PR.

rocketraman avatar Oct 18 '24 13:10 rocketraman