Stop using NSLog.
Monday 8 February 2010, 2:15AM
And start using DebugLog!
In your _prefix file (Dayta_Prefix.pch for example), add in this piece of code:
#define DEBUG_MODE
#ifdef DEBUG_MODE
#define DebugLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DebugLog( s, ... )
#endif
It’s miles better than NSLog because it lists the file, the line number, as well as being quite easy to disable (just comment out the #define DEBUG_MODE and it’s ready to go!). No longer do you have to worry about finding and deleting all of your rogue NSLogs before you submit.
To use it: just replace any old NSLog with DebugLog. Easy!