DebugMacro.h 849 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // DebugMacro.h
  3. // CommonLibrary
  4. //
  5. // Created by Alexi on 13-10-23.
  6. // Copyright (c) 2013年 ywchen. All rights reserved.
  7. //
  8. #ifndef DebugMacro_h
  9. #define DebugMacro_h
  10. // =================
  11. #ifdef DEBUG
  12. #ifndef DebugLog
  13. #define DebugLog(fmt, ...) NSLog((@"[%s Line %d]" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
  14. #endif
  15. #else
  16. #ifndef DebugLog
  17. #define DebugLog(fmt, ...) // NSLog((@"[%s Line %d]" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
  18. #endif
  19. #define NSLog // NSLog
  20. #endif
  21. // =================
  22. // 日志输出宏定义
  23. #ifdef DEBUG
  24. // 调试状态
  25. #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
  26. #else
  27. // 发布状态
  28. #define NSLog(...)
  29. #endif
  30. #endif