xcode Log 插件

1. 安装XcodeColors插件

2、下载CocoaLumberjack开源框架


3、使用

#ifdef DEBUG

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

#else

static const int ddLogLevel = LOG_LEVEL_OFF;

#endif

setenv("XcodeColors", "YES", 0);

// 实例化 lumberjack

[DDLog addLogger:[DDTTYLogger sharedInstance]];

// 允许颜色

[[DDTTYLogger sharedInstance] setColorsEnabled:YES];


lumberjack提供了四种Log方法

DDLogError(@"错误信息"); // 红色

DDLogWarn(@"警告"); // 橙色

DDLogInfo(@"提示信息"); // 默认是黑色

DDLogVerbose(@"详细信息"); // 默认是黑色

其他

如果要修改Log输出的颜色可以使用如下代码:

[[DDTTYLogger sharedInstance] setForegroundColor:[UIColor blueColor] backgroundColor:nil forFlag:LOG_FLAG_INFO];


插件目录看:

sudo open /Users/你的用户名/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins


打开终端,输入以下代码:

defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

获取到DVTPlugInCompatibilityUUID,然后

$ find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add UUID码


参考使用

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容