So this answer Do I need to disable NSLog before release Application? gives a great way to disable NSLog in a production environment, but unfortunately, this solution does n
Pure magic _isDebugAssertConfiguration() does all stuff instead of the Custom Flags-related mess:
func log(argument: T, file: String = #file, line: Int = #line, function: String = #function) {
guard _isDebugAssertConfiguration() else {
return
}
let fileName = NSURL(fileURLWithPath: file, isDirectory: false).URLByDeletingPathExtension?.lastPathComponent ?? "Unknown"
print("\(fileName)@\(line)/\(function): \(argument)")
}
See more info (and options) about it here: https://stackoverflow.com/a/34532569/496389 .