A brief introduction to the following macros: 1) __VA_ARGS__ is a variable-parameter macro, which is a new C99 specification, and currently appears to be supported only by GCC (VC6.0 compiler does not support it). The macro front Plus # #的作用在于, when the number of variable parameters is 0 o'clock, here the # #起到把前面多余的 "," removed, otherwise it will compile error. 2) __FILE__ macros are replaced with the current source file name at the time of precompilation 3) __line__ macros are replaced with the current line number 4 at precompilation) __function__ macros are replaced with the current function name 1 at precompilation. Adding, in ***-prefix.pch nslog,__optimize__ is the release default add macro #ifndef __optimize__ #define  NSLOG (...) nslog (__va_args__) #else #define  NSLOG (...) {} #endif 2. Add in ***-prefix.pch, write your own # define, and #define comment out when release version #define ios_ debug#ifdef ios_debug #define  NSLOG (...) nslog (__va_args__) #endif 3. Add #ifdef debug # define in ***-prefix.pch dlog (format, ...) nslog (@ "[File name:%s]" [function name:%s] " [line number:%d]" format), __file__, __function__, _ _line__, # #__VA_ARGS__); #else # define dlog (...); #endif This approach requires modifying the configuration of the project,Make in debug compile time, compile Dlog macro, generate verbose log information, and release when, do not produce any console output compared, or is the first kind of more convenient
iOS Development Debug and release version NSLog masking method