Stop using NSLog

NSLog is a good debugging tool some of the time. Coming from AS3 I am quite used to trace statements, and even fancy AIR solutions for runtime tracing and variable lookups and tweaking. I realize that NSLog isn’t the best way to debug applications, but it certainly is handy. However those log statements can clutter code and slow down a release application. They can slow your debug build down quite a lot as well.

I’ve seen solutions that wrap NSLog with #ifdef statements and what a colossal pain in the ass that can turn out to be. No thanks, unless I inherit that code. It might be nice to simply have a checkbox someplace in Xcode that will either include logging for debug builds or will not include it. Release would never have them included. Potentially. Wouldn’t that be better than using conditionals or NSLog replacements?

I planned on linking up a long list of present solutions – but you’re probably either very aware of them already or know the limitations in using them. They make things easier, yes. But in my opinion not a true solution. I’m looking to Apple Xcode developers to make this much more elegant.

Continue reading “Stop using NSLog”

Tagged : / /