当前正在集成测试SDK,有一个名为DebugLog日志宏命令:
#ifdef DEBUG
#define DebugLog(s,...) NSLog(@"Thread:%@ [%@ %@] %@", [[NSThread currentThread] name], NSStringFromClass([self class]), NSStringFromSelector(_cmd), [NSString stringWithFormat:s,##__VA_ARGS__])
#else
#define DebugLog(s,...)
#endif
现在要将TFLog集成到工程中来:
#define NSLog(__FORMAT__, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
问题是,有没有办法能让DebugLog
的日志重新定向到TFLog
中?比如,DebugLog
启动记录到控制台,同时也记录到TFLog
中。
谢谢。
用用我的代码:
//Here I have added NSLog followed by TFLog
#define DebugLog(s,...) NSLog(@"Thread:%@ [%@ %@] %@", [[NSThread currentThread] name], NSStringFromClass([self class]), NSStringFromSelector(_cmd), [NSString stringWithFormat:s,##__VA_ARGS__]);TFLog(s,##__VA_ARGS__)
//You can use this within #ifdef #endif construct