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



Question:

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?


Solution: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


Solution: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!


Solution: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


Solution: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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »