Through this code we can use NSLOG whenever required. Write this snippet in some common file(say utility) so that it would be easily handled throughout the project.
Make sure class should import utility class to handle NSLog.
All you need is to change the debugging mode(APP_DEBUG_MODE) in this code. Set the debugging mode(APP_DEBUG_MODE) to 1 when you want NSLOG to work otherwise 0.
#define APP_DEBUG_MODE 1 // 1 if DEBUG_MODE is ON, 0 for OFF
#if APP_DEBUG_MODE
#define NSLog(...) NSLog(@"%s %@", PRETTY_FUNCTION, [NSString stringWithFormat:__VA_ARGS__])
#else
#define NSLog(...) do { } while ( 0 )
#endif
0 Comment(s)