Last active
April 14, 2016 02:35
-
-
Save motokiee/f625f38d3da21e626149 to your computer and use it in GitHub Desktop.
Original debug log in Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func DebugLog(@autoclosure condition: () -> Bool = true, _ message: String = "", function: StaticString = __FUNCTION__, file: StaticString = __FILE__, line: UInt = __LINE__) { | |
| #if DEBUG | |
| if let fileName = NSURL(string: String(file))?.lastPathComponent { | |
| print("time: \(NSDate()), message: \(message), function: \(function), file: \(fileName), line: \(line)") | |
| } else { | |
| print("time: \(NSDate()), message: \(message), function: \(function), file: \(file), line: \(line)") | |
| } | |
| assert(condition, message, file: file, line: line) | |
| #endif | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment