美文网首页
记录:iOS开发关于Xcode 控制台打印服务器响应数据不全的问

记录:iOS开发关于Xcode 控制台打印服务器响应数据不全的问

作者: MM面包 | 来源:发表于2022-03-30 11:55 被阅读0次

并非原创,简单加工

原文:
1.https://www.jianshu.com/p/d396deb01cf2
2.https://www.jianshu.com/p/001e0c310f5e

// 打印输出
#ifdef RELEASE
#define NSLog(format, ...)
#else
#define NSLog(FORMAT, ...) {\
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];\
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];\
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];\
[dateFormatter setTimeZone:timeZone];\
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];\
NSString *str = [dateFormatter stringFromDate:[NSDate date]];\
fprintf(stderr,"【TIME:%s】【FILE:%s-- LINE:%d】FUNCTION:%s\n%s\n",[str UTF8String],[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__,__PRETTY_FUNCTION__,[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);\
}
#endif

相关文章

网友评论

      本文标题:记录:iOS开发关于Xcode 控制台打印服务器响应数据不全的问

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