Created
October 25, 2011 19:03
-
-
Save jeksys/1313867 to your computer and use it in GitHub Desktop.
Xcode log macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); | |
#define MARK CMLog(@"%s", __PRETTY_FUNCTION__); | |
#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; | |
#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); | |
#if DEBUG==1 | |
#define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); | |
#define MARK CMLog(@"%s", __PRETTY_FUNCTION__); | |
#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; | |
#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); | |
#else | |
#define CMLog(format, ...) | |
#define MARK | |
#define START_TIMER | |
#define END_TIMER(msg) | |
#endif | |
CMLog(@"My iPhone is an %@, v %@", [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion]); | |
// Just add this to your Debug target setting: OTHER_CFLAGS = -DDEBUG=1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment