func SSLog<T>(_ message: T, file : String = #file, methodName: String = #function, lineNumber : Int = #line) {
#if DEBUG
///带后缀 .swift
// let fileName = (file as NSString).lastPathComponent
///去掉 .swift
let filePath = file as NSString
let filePath_copy = filePath.lastPathComponent as NSString
let fileName = filePath_copy.deletingPathExtension
print("\n\(fileName) : \(methodName)__ \(lineNumber) __:\n\(message)")
#endif
}
//工具类写下这个函数之后, 在build settings(ALL) 里面搜索 Other Swift Flags 展开 会看见 Debug 和Release 点击DeBug 后面 + 号 key 不动 输入 value -D DEBUG 这样只是在Debug 的时候打印调试信息, release 之后不打印.
Swift 自定义打印, 自定义输出函数 ,自定义log, Debug
猜你喜欢
转载自blog.csdn.net/clarence20170301/article/details/59529314
今日推荐
周排行