CocoaLumberjack能够带颜色Log,具体的好处嘛,谁用谁知道,:]git
具体步骤以下:github
下载地址:https://github.com/robbiehanson/XcodeColorsapp
下载地址:https://github.com/CocoaLumberjack/CocoaLumberjack框架
#ifdef DEBUG static const int ddLogLevel = LOG_LEVEL_VERBOSE; #else static const int ddLogLevel = LOG_LEVEL_OFF; #endif
#import "Common.h"
在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions测试
方法中设置DDLogspa
// 实例化 lumberjack [DDLog addLogger:[DDTTYLogger sharedInstance]]; // 容许颜色 [[DDTTYLogger sharedInstance] setColorsEnabled:YES];
lumberjack提供了四种Log方法
插件
DDLogError(@"错误信息"); // 红色 DDLogWarn(@"警告"); // 橙色 DDLogInfo(@"提示信息"); // 默认是黑色 DDLogVerbose(@"详细信息"); // 默认是黑色
若是要修改Log输出的颜色可使用以下代码:code
[[DDTTYLogger sharedInstance] setForegroundColor:[UIColor blueColor] backgroundColor:nil forFlag:LOG_FLAG_INFO];