在CocoaLumberjackself
中的每条日志消息中包含的最佳方式是什么?
我尝试了什么:
- 实现
DDLogFormatter
协议 - 日志消息的调用者在方法中不可用formatLogMessage:
。 #define
类似于:#define LogInfo(frmt, ...) DDLogInfo(([NSString stringWithFormat:@"%@: %@", self, frmt]), ##__VA_ARGS__)
(注意()
周围的额外[NSString ...]
- 谢谢hamstergene每当我想
self
弱引用时都会产生问题,例如LogInfo
在块内调用 - 包括self
可能会导致内存问题。
我错过了什么?还有其他更好的日志库吗?