Read logs using the new swift os_log api

后端 未结 1 1701
清酒与你
清酒与你 2021-02-01 23:56

Deprecated in iOS 10.0: os_log(3) has replaced asl(3)

So iOS 10.0 apparently deprecates the asl (Apple System Log) api and replaces it with the very limited os_log api.<

相关标签:
1条回答
  • 2021-02-02 00:42

    Looks like you need to use the enhanced Console instead of your own log viewer. The logs are compressed and not expanded until viewed - this makes logging much less intrusive at debug levels. There is no text form of the logs however.

    See the 2016 WWDC video session 721 "Unified Logging and Activity Tracing" https://developer.apple.com/videos/play/wwdc2016/721/

    Also the Apple sample app that demos the new approach has an undocumented build setting that I had to add to my iOS app. See the setting in the 'Paper Company (Swift)' iOS app. The setting is found in the Targets section of the top level xCode window. These are the steps that I followed:

    1. On the Build Settings page add in "User-Defined" a new section = ASSETCATALOG_COMPRESSION.

    2. Under it add two lines:

    Debug = lossless

    Release = respect-asset-catalog

    After adding this build setting then logging worked in my app as per the video session demo.

    0 讨论(0)
提交回复
热议问题