Although NSlog is convenient for outputting messages to the console, I tire of the date/time and object information that it prints.
As an alternative, one can craft a macro that uses CFShow, which outputs Core Foundation objects to stderr. CFShow uses callbacks to objects to display their descriptions, which allows one to use “%@” like you would when calling NSLog.
I often include the following debug definition as part of my projects:
A few short examples follow showing the difference in output between NSLog and the debug macro shown above.The output will now look as follows:

Here’s another example, this time passing in an object:
And the corresponding output:

Ahhh, much better.
No comments:
Post a Comment