【发布时间】:2021-02-10 11:10:16
【问题描述】:
我在 OS_Log 中使用了以下辅助方法,但我不确定是否有必要。
我想在我的 Debug 版本中记录内容,但不是(必须)在我的 Release 版本中。
我对编译器是否在发布版本中删除 os_log 语句感到困惑
public func DLog(_ string: String, subsystem: OSLog, type: OSLogType) {
#if DEBUG
os_log("%{PUBLIC}@", log: subsystem, type: type, string)
#endif
}
我可以直接使用它并为发布版本剥离日志吗?
os_log("%{PUBLIC}@", log: subsystem, type: type, string)
我很困惑……
【问题讨论】: