无标题文章

最新项目中上线了,但是打印日志的去掉啊,本来想偷个懒网上档点宏文件就OK了,结果发现好多都不能使用啊,果断自己写一份!

#if DEBUG

#define NSLog(format, ...) do {                                            \

fprintf(stderr, "<%s : %d> %s\n",                                          \

[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],  \

__LINE__, __func__);                                                        \

(NSLog)((format), ##__VA_ARGS__);                                          \

fprintf(stderr, "-------\n");                                              \

} while (0)

#define NSLogRect(rect) NSLog(@"%s x:%.4f, y:%.4f, w:%.4f, h:%.4f", #rect, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)

#define NSLogSize(size) NSLog(@"%s w:%.4f, h:%.4f", #size, size.width, size.height)

#define NSLogPoint(point) NSLog(@"%s x:%.4f, y:%.4f", #point, point.x, point.y)

#else

#define NSLog(FORMAT, ...) nil

#define NSLogRect(rect) nil

#define NSLogSize(size) nil

#define NSLogPoint(point) nil

#endif

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、设置UILabel行间距 NSMutableAttributedString*attrString=[[NSM...
    iOS祎阅读 2,233评论 0 0
  • 转至元数据结尾创建: 董潇伟,最新修改于: 十二月 23, 2016 转至元数据起始第一章:isa和Class一....
    40c0490e5268阅读 1,824评论 0 9
  • Effective TensorFlow Table of Contents TensorFlow Basics ...
    法布雷加嘻阅读 590评论 0 1
  • http://www.open-open.com/lib/view/open1390651437117.html ...
    Xtuphe阅读 1,299评论 0 10
  • 总于做了有关于你的梦 梦里,我们在同一屋檐下 却隔着两道紧闭的房门 我们见过一次面 但却相敬如宾
    Stone_soul阅读 125评论 0 0