我正在使用以下帮助方法与OS_Log一起使用,但我不确定是否必要。
我希望在我的Debug版本中记录日志,但不一定要在Release版本中(记录日志)。
我不确定编译器是否会在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)
我感到困惑...