3 回答

TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊
#ifdef DEBUG# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)#else# define DLog(...)#endif// ALog always displays output regardless of the DEBUG setting#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
-[LibraryController awakeFromNib] [Line 364] Hello world

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超4個(gè)贊
DLog
ALog
ULog
UIAlertView
DLog
輸出會(huì)像 NSLog
只有在設(shè)置了調(diào)試變量時(shí) ALog
總是輸出類似 NSLog
ULog
將顯示 UIAlertView
只有在設(shè)置了調(diào)試變量時(shí)
#ifdef DEBUG # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #else # define DLog(...) #endif #define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #ifdef DEBUG # define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } #else # define ULog(...) #endif

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
NSLog(@"%s %d %s %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);
/proj/cocoa/cdcli/cdcli.m 121 managedObjectContext managedObjectContext
__FUNCTION__
__PRETTY_FUNCTION__
#define NSLog
- 3 回答
- 0 關(guān)注
- 561 瀏覽
添加回答
舉報(bào)