iOS开发 解决NSLog打印不全以及打印中文乱码的问题
作者:互联网
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr, "[%s %s %s %s-第%d行] %s\n", __DATE__ , __TIME__, __func__, [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[[NSString alloc] initWithData:[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] dataUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding] UTF8String]?[[[NSString alloc] initWithData:[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] dataUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding] UTF8String]:[[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]);
#define NSFunc() NSLog(@"%s 第%d行",__func__,__LINE__);
#else
#define NSLog(FORMAT, ...) nil;
#define NSFunc(...);
#endif
标签:__,FORMAT,UTF8String,打印,iOS,乱码,NSString,NSLog,define 来源: https://blog.csdn.net/weixin_38934440/article/details/120682897