Created
October 21, 2015 16:04
-
-
Save yarshure/fadfac2008459b562edb to your computer and use it in GitHub Desktop.
log style
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
extension String : CollectionType {} | |
func myLog<T>(object: T, _ file: String = __FILE__, _ function: String = __FUNCTION__, _ line: Int = __LINE__) { | |
let fn = file.split { $0 == "/" }.last | |
if let f = fn { | |
let info = "\(f).\(function)[\(line)]:\(object)" | |
NSLog(info) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
other version
public func myLog(object: T, _ file: String = FILE, _ function: String = FUNCTION, _ line: Int = LINE) {
//let fn = file.split { $0 == "/" }.last
let fn = file.characters.split { $0 == " " }.map(String.init).last
if let f = fn {
let info = "(f).(function)[(line)]:(object)"
NSLog(info)
}
}