I\'d like to be able to put trace messages of the current class name and method name for all classes in my project.
Is there a way to get the current method\'s name
NSLog(@"method name: %@", NSStringFromSelector(_cmd));
_cmd
is a hidden argument (like self
) that all Objective-C methods receive. Its value is the selector that was used to call the method.
This also works:
NSLog(@"%@", [NSString stringWithUTF8String:__func__])
EDITED: i think this method is more generic...check it out..
NSLog(@"%s", __PRETTY_FUNCTION__);