Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to submit the iPhone app binary with NSLog statements?

Tags:

iphone

nslog

I am just about to submit my first iPhone app.

I have put lots of NSLog statements to test and debug the application .

So my question is " Is it ok to keep the NSLog statements in the source code "

and I have a doubt that whether the nslog statements slows down the total execution time or not .

thanks.

like image 1000
harshalb Avatar asked Feb 05 '10 14:02

harshalb


1 Answers

I used this all the time (found it somewhere):

// DLog is almost a drop-in replacement for NSLog to turn off logging for release build
// 
// add -DDEBUG to OTHER_CFLAGS in the build user defined settings
//
// Usage:
//
// DLog();
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
//

#ifdef DEBUG
#   define DLog(__FORMAT__, ...) NSLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#   define DLog(...) do {} while (0)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(__FORMAT__, ...) NSLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)

The three20 project from Facebook has more complex way to debug or logging.

like image 71
Jesse Armand Avatar answered Sep 25 '22 21:09

Jesse Armand