代码改变世界

NSLog 宏

2012-09-16 19:28  Orin  阅读(217)  评论(0编辑  收藏  举报

在头文件中加入如下宏就可以实现只在调试模式下输出调试信息,提高Relase性能。

1 #ifndef __OPTIMIZE__ 
2 #    define NSLog(s, ...) NSLog( @"<%s : (%d)> %@",__FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] ) 
3 #else 
4 #    define NSLog(...) {} 
5 #endif