我目前正在集成试飞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
我现在想将 Testflight 的 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
关于iphone - 如何将现有应用程序日志复制到 TestFlight 并使用宏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14401277/