xcode日志输出(区分真机和模拟器)

1、日志打印(xcode8之后添加 OS_ACTIVITY_MODE disable 字段真机模式下会被屏蔽所有日志,所以用2)

#ifdef DEBUG
# define LX_DLog(fmt, ...) NSLog((@"[文件名:%s]\\n" "[函数名:%s]\\n" "[行号:%d] \\n" fmt), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define LX_DLog(...);
#define NSLog(...) {}
#endif

2、真机日志

#ifdef DEBUG
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define LRLog(...) printf("%s: %s 第%d行: %s\\n\\n",[[NSString lr_stringDate] UTF8String], [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
#else
#define LRLog(...)
#endif
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容