standwally

DEBUG모드에서만 로그출력하기 본문

프로그래밍/Xcode

DEBUG모드에서만 로그출력하기

standwally 2012. 10. 23. 16:04

아래 소스코드를 .pch파일에 추가해준 다음에,

프로젝트 셋팅에서 -D_DEBUG_LOG를 추가해준다.


// for DEBUGGING Log option, Add "-D_DEBUG_LOG" in "Debug Build Settings => Apple LLVM compiler 4.x - Language => Other C Flags"
// in Release settings, just DO NOT USE "-D_DEBUG_LOG" then all "NSLog()" will be ignored !
#ifdef _DEBUG_LOG
#define NSLog(fmt, ...) NSLog((@"%s[Line: %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define NSLog(...)
#endif