最近發(fā)現(xiàn)xcode8更新后NSLog信息經(jīng)常打印不全,網(wǎng)上搜了各種方法,最后還是使用printf代替了系統(tǒng)的NSLog.而且在log時加入了打印代碼位置的小功能,非常好用!
#define YFLog(format, ...) printf("class: < %s:(%d行) > method: %s \n%s\n", [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )