Last active
August 29, 2015 14:13
-
-
Save berikv/7852e6647b55c4c8445a to your computer and use it in GitHub Desktop.
Simple logging in swift
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
func log<T>(message: T, fileName: String = __FILE__, lineNumber: Int = __LINE__, args: CVarArgType...) { | |
let date = NSDate() | |
let processInfo = NSProcessInfo() | |
let appName = processInfo.processName | |
let combined = String(format: String(stringInterpolationSegment: message), arguments: args) | |
println("\(date) \(appName) [\(fileName.lastPathComponent):\(lineNumber)] \(combined)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment