Is there a way color-code the iPhone Debugger Console display in Xcode?

独自空忆成欢 提交于 2020-01-13 02:54:48

问题


I observed Android programmers using LogCat to see colored Debugger Console output. It looks like you can have different classes do their debug output in different colors. Is this possible when developing for iPhone?


回答1:


Here's a fork of the XcodeColors plug-in suggested above that works great in XCode 4.2 and has a custom format that's easier to use than the ANSI color-codes, and supports any color.

https://github.com/robbiehanson/XcodeColors




回答2:


You can log with tags to your own file, and open it with an editor that shows colors for the tags.

I do not think it is possible to show colors using the default logger.

You can define a custom logging function to write tags automatically for the colors, take a look here, it may be a starting point.

Good luck!




回答3:


I just finished a simple debug logger in Swift. It cannot display any other color but it will show the icon at the head of the log to make you recognize the log level easily.

Following is the result:

🌀2016-04-26 10:07:56.683 [Debug][ViewController.swift][actionPrintDebug-20] It's debug

🍀2016-04-26 10:07:57.185 [Info][ViewController.swift][actionPrintInfo-23] It's info

⚠️2016-04-26 10:07:57.678 [Warning][ViewController.swift][actionPrintWarning-26] It's warning

❌2016-04-26 10:07:58.267 [Error][ViewController.swift][actionPrintError-29] It's error

There are some problems with displaying warning icon here, but it can display correctly in Xcode.

GitHub tutorial: https://github.com/aac1109/SimLogger




回答4:


There is a way:

Inside Xcode, go to:

Xcode>>Preferences>>Fonts and Colors>>Console Tab

Then you can customize the debugger output colors to your hearts content.



来源:https://stackoverflow.com/questions/3288895/is-there-a-way-color-code-the-iphone-debugger-console-display-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!