Logging is an essential tool when developing for iPhone. Keeping things simple and code readable is a major challenge when scattering logging code throughout your application. A few recent posts on the topic have provided some great solutions, but if you're like me sometimes a dead-simple solution is exactly what you need.
This is what I use:
// in Implementation.m
#define DLog NSLog
...
// I need to log something
DLog(@"something interesting happended: %@",what)
When I want to disable logging in that file, I simply change the #define as follows:
#define DLog // NSLog
That's all!
1 comment:
Nice! Preprocessors for the win! :-)
Post a Comment