美文网首页
NSLog自定义常用方法

NSLog自定义常用方法

作者: 彭小先生 | 来源:发表于2019-01-29 17:54 被阅读0次
// 表明一下宏定义内容只会在OC代码中有用
#ifdef __OBJC__
// debug模式下会有打印日志 release下不会打印日志
#ifdef DEBUG
#define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define NSLog(...)
#endif
#endif
显示文字
#define XBLog(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )

相关文章

网友评论

      本文标题:NSLog自定义常用方法

      本文链接:https://www.haomeiwen.com/subject/uezxsqtx.html