當前正在集成測試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