重写NSLog,Debug模式下打印日志和当前行数

在pch文件中加入以下命令,NSLog在真机测试中就不会打印了

//重写NSLog,Debug模式下打印日志和当前行数

#if DEBUG

#define NSLog(FORMAT, ...) fprintf(stderr," function:%s line:%d content:%s ", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

#else

#define NSLog(FORMAT, ...) nil

#endif

原文地址:https://www.cnblogs.com/lantu1989/p/5254834.html