0
基本上,我想简单的东西像如何使Dlog日志(定制xcode NSLog)?
TimeLog {...};
如何使用宏,要更换的
Dlog ("Calling computeTime");
[Tools computeTime:^{...}];
occurances?
例如DLOG是
#ifdef DEBUG
#define DLog(s, ...) NSLog(@"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
#else
#define DLog(s, ...)
#endif
我有这样
+(void) computeTime:(void (^)())block
{
NSDate * currentTime = [NSDate date];
block();
DLog(@"Time Running is: %f", [[NSDate date] timeIntervalSinceDate:currentTime]);
}
此功能是无用的,因为我不知道调用函数的函数。我们如何决定调用函数?
我想使这个功能就像定义DLOG
可能是这样的
#ifdef DEBUG
#define TimeLog {...} [Tools computeTime:^{...}];
#else
#define TimeLog {...}
#endif
但它仍然是错误,任何一个能地狱我解决它?
所以我可以调用时间记录,如 TimeLog {DoSomething的} 并把它转换成: DLOG( “调用computeTime”); [Tools computeTime:^ {doSomething}];
宏是什么?
我该怎么做呢?
那么我该怎么做? –