Swift(一):函数封装--自定义 Log函数
作者:
IMSong | 来源:发表于
2016-08-08 00:09 被阅读33次
![](https://img.haomeiwen.com/i1155000/728950378d0e8148.png)
配图.png
/**
自定义 Log 函数
- parameter log: log内容
- parameter file: log 函数所在的文件
- parameter method: log 函数所在的方法
- parameter lineNum: log 函数所在的行数
*/
func SLog<T>(log:T,file : String = #file , method :String = #function , lineNum : Int = #line) {
//Debug需要在 info.plist 文件配置,详见配图
#if Debug
let fileName = ( file as NSString ).lastPathComponent
print("[\(fileName) : \(method)] Line:\(lineNum) Log:\(log)" )
#endif
}
本文标题:Swift(一):函数封装--自定义 Log函数
本文链接:https://www.haomeiwen.com/subject/txolsttx.html
网友评论