JMessageLog.swift 636 B

1234567891011121314151617181920212223242526
  1. //
  2. // Log.swift
  3. // JChat
  4. //
  5. // Created by 邓永豪 on 2017/10/5.
  6. // Copyright © 2017年 HXHG. All rights reserved.
  7. //
  8. import UIKit
  9. /**
  10. print log
  11. #file String 包含这个符号的文件的路径
  12. #line Int 符号出现处的行号
  13. #column Int 符号出现处的列
  14. #function String 包含这个符号的方法名字
  15. */
  16. func printLog<T>(_ message: T,
  17. file: String = #file,
  18. method: String = #function,
  19. line: Int = #line)
  20. {
  21. #if DEBUG
  22. print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")
  23. #endif
  24. }