Hi Team,
I went through WWDC 2018 video on 405_measuring_performance_using_logging and would like to replace existing logging mechanism with os_log to gain its benifits with signposts to measure performance.
But there is main blocker as listed below:
1. Current logging mechanism provides easy way to share the App logs by click of button,without need of external systems like Mac/Windows/iTune and its specific to our app resulting in minimum file size in KBs.
How could we achieve this by migrating to os_log, as it logs into a common bulky sysdiagnose file?
1.Could we wrap os_log to log to a file in App's documents folder?
Simple sample code will be helpful, as I could not find more info on wrapping os_log.
2. Could I programatically access sysdiagnose with filters of "my catogery" and export into App's local folder to share as before?
Thanks a ton in Advance!
1. Could we wrap os_log to log to a file in App's documents folder?
Wrapping
os_log
is not recommended. Specifically, it’s a bad idea to wrap
os_log
with a function because you undermine a lot of its smarts with regards efficiently storing constant strings. In C-based languages you can get around this by wrapping it with a macro, but that option is not available in Swift.
2. Could I programatically access sysdiagnose with filters of "my catogery" and export into App's local folder to share as before?
There’s no way to do this currently, but it would make a fine enhancement request.
FYI, and I only just learnt this myself, you don’t need to use iTunes to grab a sysdiagnose log. You can export it via Settings > Privacy > Analytics > Analytics Data. That doesn’t help with the file size, but it does smooth over one obstacle.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"