【Swift】自定义print函数打印出文件名、方法名、行号
///< MARK: print
func LLog<T>(_ message: T, file: String = #file, function: String = #function, lineNumber: Int = #line) {
#if DEBUG
let fileName = (file as NSString).lastPathComponent
print("[\(fileName):funciton:\(function):line:\(lineNumber)]- \(message)")
#endif
}
输出的效果
网友评论