5

我正在尝试将CocoaLumberjack集成到现有项目中(以便我可以更好地登录报告我无法复制的错误的客户机器)。我已经成功地构建了一个示例项目并让它在其中工作,但它似乎在我自己的应用程序中什么也没做。

我已将 Lumberjack 目录复制到我的项目目录并将其添加到项目中。我已将以下内容添加到我的“Prefix.pch”文件中:

#import "DDLog.h"
#import "DDASLLogger.h"
#import "DDTTYLogger.h"
#import "DDFileLogger.h"

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

我已将以下内容放入-applicationDidFinishLaunching:

[DDLog addLogger:[DDASLLogger sharedInstance]];
[DDLog addLogger:[DDTTYLogger sharedInstance]];

最后我有以下内容-awakeFromNib

NSLog(@"%@", @(ddLogLevel));
NSLog(@"%@", @(LOG_LEVEL_VERBOSE));
NSLog(@"%@", @"About to DDLog");
DDLogError(@"This is an error.");
DDLogWarn(@"This is a warning.");
DDLogInfo(@"This is just a message.");
DDLogVerbose(@"This is a verbose message.");
NSLog(@"%@", @"Done with DDLog");

控制台显示:

2014-05-26 14:57:13.530 [21943:303] 31
2014-05-26 14:57:13.530 [21943:303] 31
2014-05-26 14:57:13.530 [21943:303] About to DDLog
2014-05-26 14:57:13.531 [21943:303] Done with DDLog

我尝试过单步执行库的源代码,但老实说,这超出了我的想象。任何帮助找出我做错了什么将不胜感激。

4

0 回答 0