Created
November 6, 2015 02:00
-
-
Save jlyonsmith/dea70d8f42101f555dbd to your computer and use it in GitHub Desktop.
This file contains 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
public func Log<T>(item: T, fileName: String = __FILE__, line: Int = __LINE__, funcName:String = __FUNCTION__) { | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.dateFormat = "MM/dd/yyyy HH:mm:ss:SSS" | |
let process = NSProcessInfo.processInfo() | |
let threadId = "?" | |
var shortFileName = (NSURL(string: fileName)?.lastPathComponent?.componentsSeparatedByString(".").first) | |
if shortFileName == nil { | |
shortFileName = "unknown" | |
} | |
print("\(dateFormatter.stringFromDate(NSDate())) \(process.processName))[\(process.processIdentifier):\(threadId)] \(shortFileName)(\(line)) \(funcName): \(item)\n") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment