91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

DDLog使用了解

發布時間:2020-07-28 09:39:32 來源:網絡 閱讀:1940 作者:xinji0702 欄目:開發技術



利用xcodeColors插件方法,使得不同的打印方法打印的顏色不一樣,來凸顯重點信息


It's sometimes helpful to color-coordinate your log messages. For example, you may want your error messages to print in red so they stick out.
This is possible with DDTTYLogger and XcodeColors.

DDLog使用了解

Install XcodeColors

XcodeColors is a simple plugin for Xcode.
It allows you to use colors in the Xcode debugging console.

Full installation instructions can be found on the XcodeColors project page:
https://github.com/robbiehanson/XcodeColors

But here's a summary:

  • Download the plugin

  • Slap it into the Xcode Plug-ins directory

  • Restart Xcode

Enable Colors

All it takes is one extra line of code to enable colors in Lumberjack:

// Standard lumberjack initialization[DDLogaddLogger:[DDTTYLoggersharedInstance]];// And we also enable colors[[DDTTYLoggersharedInstance]setColorsEnabled:YES];

The default color scheme (if you don't customize it) is:

  • DDLogError : Prints in red

  • DDLogWarn : Prints in orange

However, you can fully customize the color schemes however you like!
In fact, you can customize the foreground and/or background colors.
And you can specify any RGB value you'd like.

// Let's customize our colors.// DDLogInfo : Pink#if TARGET_OS_IPHONEUIColor*pink=[UIColorcolorWithRed:(255/255.0)green:(58/255.0)blue:(159/255.0)alpha:1.0];#elseNSColor*pink=[NSColorcolorWithCalibratedRed:(255/255.0)green:(58/255.0)blue:(159/255.0)alpha:1.0];#endif[[DDTTYLoggersharedInstance]setForegroundColor:pinkbackgroundColor:nilforFlag:LOG_FLAG_INFO];DDLogInfo(@"Warming up printer");// Prints in Pink !

XcodeColors and iOS

You may occasionally notice that colors don't work when you're debugging your app in the simulator. And you may also notice that you colors never work when debugging on the actual device. How do I fix it so it works everywhere, all the time?

You can fix it in a few seconds. Here's how.

  • In Xcode bring up the Scheme Editor (Product -> Edit Scheme...)

  • Select "Run" (on the left), and then the "Arguments" tab

  • Add a new Environment Variable named "XcodeColors", with a value of "YES"

DDLog使用了解

Your colors should now work on the simulator and on the device, every single time.

More information:

The XcodeColors plugin is automatically loaded by Xcode when Xcode launches. When XcodeColors runs, it sets the environment variable "XcodeColors" to "YES". Thus the Xcode application itself has this environment variable set.

It is this environment variable that Lumberjack uses to detect whether XcodeColors is installed or not. Because if Lumberjack injects color information when XcodeColors isn't installed, then your log statements have a bunch of garbage characters in them.

Now any application that Xcode launches inherits the environment variables from Xcode. So if you hit build-and-go, and Xcode launches the simulator for you automatically, then the colors will work. But if you manually launch the simulator, then it doesn't inherit environment variables from Xcode (because Xcode isn't the process' parent in this case). It's a similar problem when debugging on the actual device.

Colors in the Terminal

If you ever do any debugging in the Terminal, then you're in luck! DDTTYLogger supports color in terminals as well.

If your shell supports color, the DDTTYLogger will automatically map your requested colors to the closest supported color by your shell. In most cases your terminal will be "xterm-256color", so your terminal will support 256 different colors, and you'll get a close match for whatever RGB values you configure.





向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

周宁县| 沐川县| 辛集市| 什邡市| 昂仁县| 禄丰县| 乐至县| 梁山县| 宿州市| 永寿县| 武陟县| 庄河市| 武定县| 黑山县| 连南| 南乐县| 鲁甸县| 五莲县| 富宁县| 蚌埠市| 龙州县| 贺兰县| 枞阳县| 汝南县| 安西县| 尼勒克县| 福州市| 湘潭市| 绵阳市| 石阡县| 松潘县| 武隆县| 团风县| 尤溪县| 兴国县| 呼和浩特市| 吕梁市| 聂拉木县| 宜州市| 婺源县| 三江|