您的位置:首页 > 其它

CocoaLumberjack 踩坑

2016-10-24 09:39 232 查看
最近想要导入CocoaLumberjack Log第三方库,来给调试或者以后用户特例问题定位”加点颜色”。

cocoa pod导入这个库。

按照网上的教程添加上去,

但是遇到2个问题

1. 设置log的format

2. 没有设置log的level

format。。。

至今不知道怎么设置。。

Use of undeclared identifier ddloglevel

解决方法

pch中加入

#import <CocoaLumberjack/CocoaLumberjack.h>
#import "DDLog.h"

#ifdef DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
#else
static const int ddLogLevel = LOG_LEVEL_WARN;
#endif


AppDelegate中添加以下代码

[DDLog addLogger:[DDTTYLogger sharedInstance]];


然后就可以开始测试了

NSLog(@"configLOG");
DDLogInfo(@"DDLogInfo");
DDLogWarn(@"warn");
DDLogVerbose(@"verbose");
DDLogError(@"error");


参考资料

http://blog.csdn.net/lmyuanhang/article/details/50549553

https://github.com/robbiehanson/XcodeColors
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  log