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?
-
Take a look at XcodeColors: http://deepitpro.com/en/articles/XcodeColors/info/ – myell0w Sep 29 '11 at 21:22
-
I was using that with ANSI colors but it stopped working in the latest XCode (for me at least). Is it working for you? – Jano Sep 29 '11 at 22:10
4 Answers
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.

- 1,282
- 12
- 29
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!

- 20,420
- 10
- 92
- 149
-
thanks for the idea. the linked site doesn't have anything to do with colors; it's just about having your own preprocessor #define for adding function/line info to the debug output. this is something that i already do (and the implementation i'm using is more advanced than the one in the article). what's an example of an editor that shows colors for tags? do i need to write to a file manually (i.e. write code in my app that does it)? – Elliot Jul 20 '10 at 10:43
-
In mac you can use Smultron for coloring syntax (if you are on windows or linux I'd use Notepad++). You can just use tags of an existing language syntax or define your custom syntax coloring (would probably be much better). Yes, you will have to write code for writing to the log file. – Daniel Jul 20 '10 at 11:56
-
It seems that you can use freopen to log to a file. See http://stackoverflow.com/questions/202299/logging-to-a-file-on-the-iphone and http://www.cocoadev.com/index.pl?NSLogToFile – Daniel Jul 21 '10 at 06:44
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

- 1
- 1
-
A link to a potential solution is always welcome, but please [add context around the link](//meta.stackoverflow.com/a/8259/169503) so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. Take into account that being _barely more than a link to an external site_ is a possible reason as to [Why and how are some answers deleted?](//$SITEURL$/help/deleted-answers). – JAL Apr 26 '16 at 01:34
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.

- 845
- 1
- 9
- 21