I want to use some NSAssert stuff and other things to enable better debugging in my app. NSAssert wants a string which it prints if the assertion fails. Nice, but useless unless you type a whole bunch of information in that string, which can become a big mess when done all over the place.
So I want to make a macro that will do the NSAssert call with an string equipped full of useful information like the class name, the method name and other stuff. But more important, I want to provide a custom comment as well. Imagine a macro like this:
USEFUL_ASSERT(foo != nil, @"that wasn't good, really")
for a lot of reasons I can't use a function or method call here, because context would be lost and I could not find out which class caused that problem, which method caused that problem. That can only be done inside that method itself, so I would have to pass a lot of parameters for this information like [self class] and _cmd, but I don't want all this stuff scattered everywhere. The shorter the code to insert, the better to maintain.
Any idea?