版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/glt_code/article/details/72885996
swift3.0 自定义Log
1.开发模式下打印Log,发布模式下不打印Log配置(如图)
2.代码实现(文件名 -- 函数名 -- 行数 -- 自定义Log)
public func LTLog<T>(funcName: String = #function,_ message: T,file: String = #file, line: Int = #line) {
#if LTDEBUG
let files = (file as NSString).lastPathComponent.replacingOccurrences(of: ".swift", with: "")
print("\(files) --> \(funcName) --> \(line) --> \(message) ")
#endif
}
3.调用