- 用DLog代替NSLog,在Debug模式下就会输出较详细的信息,包括方法名,行数以及想要输出的内容。
- ALog无论在Debug还是在Release模式下都会输出。
- 下面是一个宏定义:
-
- // DLog is almost a drop-in replacement for NSLog
- // DLog();
- // DLog(@"here");
- // DLog(@"value: %d", x);
- // Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
- #ifdef DEBUG
- # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
- #else
- # define DLog(...)
- #endif
- // ALog always displays output regardless of the DEBUG setting
- #define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
Dlog 替代 NSLog
最新推荐文章于 2020-12-21 01:22:39 发布