-(id) initWithPlayer:(VVPlayer *)aPlayer seatsNum:(int)seatsNum { if (self = [super init]) { NSLog(@”\n Function: %s\n Pretty function: %s\n Line: %d\n File: %s\n Object: %@”,__func__, __PRETTY_FUNCTION__, __LINE__, __FILE__, aPlayer); } … }
__func__ __PRETTY_FUNCTION__ __LINE__ __FILE__都是系统预留的定义词,简单易用
另外还有一些Core Foundation的方法可以从CFString的层级拿到一些有用的字符串,包括且不限于selector、class、protocol等
-(id) initWithPlayer:(VVPlayer *)aPlayer seatsNum:(int)seatsNum { if (self = [super init]) { NSLog(@”Current selector: %@”, NSStringFromSelector(_cmd)); NSLog(@”Object class: %@”, NSStringFromClass([self class])); NSLog(@”Filename: %@”, [[NSString stringWithUTF8String:__FILE__] lastPathComponent]); } … }
原文:http://www.cnblogs.com/luseike/p/4073268.html