Objective C Logger

Another Objective C Code Snippet. Looking for a clean way to control your debug logging? This is a great solution.
// DLog is almost a drop-in replacement for NSLog
// DLog();
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
ifdef DEBUG_LOGGING
define DEBUG_LOG(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
else
define DEBUG_LOG(...)
endif
Taken from: http://iphoneincubator.com/blog/debugging/the-evolution-of-a-replacement-for-nslog

0 comments: