0

我想RestKit将其错误和警告消息记录到文件中。

它正确地用 记录这些消息NSLog,但仅此而已;虽然我在我的项目中添加了以下两个 pod:

pod 'LibComponentLogging-pods'
pod 'LibComponentLogging-LogFile'

我设法将正常日志记录到文件中:

lcl_log(lcl_cMain, lcl_vInfo, @"log message %d", 2);

例如,此日志显示在创建的日志文件中,而不是 RestKit 日志中。

如何告诉 RestKit 也将其日志重定向到同一个文件?

4

2 回答 2

1

我不确定是否有更好的方法,但一个直接且略显“hacky”的选项可能是NSLoglcl_log().

#define NSLog(x) lcl_log(lcl_cMain, lcl_vInfo, x, 2); 
于 2014-07-03T14:46:23.847 回答
1

在https://github.com/aharren/LibComponentLogging-configure查看示例 2

之后pod install,您可以运行lcl_configure pod它将 RestKit pod 与您的 LibComponentLogging pod 集成。RestKit 然后将使用通过您的 Podfile 配置的日志记录后端。

lcl_configure将通过LibComponentLogging-podspod 安装,并且可以通过Pods/LibComponentLogging-pods/configure/lcl_configure pod.

于 2014-07-04T22:03:01.963 回答