in a class, if you overload the -(NSString *)description
method, you can easily log class info with NSLog(@"%@", some_object);
here's a fictitious example:
-(NSString *)description
{
return [NSString stringWithFormat:@"%@, %@, %d",
[super description],
class.object_ivar,
class.int_ivar];
}
You can use standard C macros to get things like name, file, line number etc...
use the NSThread classes to get information about what thread the method is being called on.
I posted this one to twitter. http://twitter.com/kailoa/status/1349928820 Feel free to follow me if you are interested in more tidbits like this. I try to put them up regularly.
#define METHOD_LOG (NSLog(@"%@ %s\n%@", NSStringFromSelector(_cmd), __FILE__, self))