[Swift]ログメソッド
ログメソッド
func LOG(message:String = "", file:String = __FILE__, funcName:String = __FUNCTION__, line:Int = __LINE__) { #if DEBUG var f:String = file.componentsSeparatedByString("/").last! var cnt:Int = 45 - f.utf16Count while 0 < cnt { f += " " cnt-- } var sline:String = String(line) cnt = 4 - sline.utf16Count while 0 < cnt { sline = " "+sline cnt-- } if message.isEmpty { println("\(f) - \(sline) - \(funcName)") }else{ println("\(f) - \(sline) - \(funcName)\n -> \(message)") } #endif }
出力結果
ViewController.swift - 65 - onChangeTimeScale -> selectedIndex : 0