Created
December 17, 2015 00:08
-
-
Save hishma/e61b0f0ea1b47c1428b0 to your computer and use it in GitHub Desktop.
Debug like a caveman 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 logPretty(message: String? = nil, file: String = __FILE__, line: UInt = __LINE__, function: StaticString = __FUNCTION__) { | |
var pretty = "\((file as NSString).lastPathComponent)(\(line)) : \(function)" | |
if let message = message where !message.isEmpty { | |
pretty += " ☞ \(message)" | |
} | |
print(pretty) | |
} | |
func dlogPretty(message: String? = nil, file: String = __FILE__, line: UInt = __LINE__, function: StaticString = __FUNCTION__) { | |
#if DEBUG | |
logPretty(message, file: file, line: line, function: function) | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great