Go to your Build settings and under the Debug configuration add a value to "Preprocessor Macros" value like: DEBUG_MODE=1
Make sure you only do this for the Debug configuration and not for Beta or Release versions. Then in a common header file you can do something like:
#ifdef DEBUG_MODE
#define DLog( s, ... ) NSLog( @"<%@:(%d)> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DLog( s, ... )
#endif
Now instead of NSLog use DLog everywhere. When testing and debugging, you'll get debug messages.
Make sure you only do this for the Debug configuration and not for Beta or Release versions. Then in a common header file you can do something like:
#ifdef DEBUG_MODE
#define DLog( s, ... ) NSLog( @"<%@:(%d)> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DLog( s, ... )
#endif
Now instead of NSLog use DLog everywhere. When testing and debugging, you'll get debug messages.
No comments:
Post a Comment
Comment