in a class, if you overload the method -(NSString *)description , you can easily write class information using NSLog(@"%@", some_object);
here's a dummy 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 which thread the method is being called on.
I posted this twitter. http://twitter.com/kailoa/status/1349928820 Feel free to follow me if you are interested in more tidbits. I try to raise them regularly.
#define METHOD_LOG (NSLog(@"%@ %s\n%@", NSStringFromSelector(_cmd), __FILE__, self))
amattn
source share