说明:原文均非常清晰,这里仅提供链接,稍加说明以备份。
苹果官方对此提供了简单明了的相关文档:
Technical Q&A QA1669: Improved logging in Objective-C
【注 1】与此文档相关的 GCC 文档:Function Names as Strings
【注 2】Objective-C 所有方法(instance method 或 class method)都有两个隐藏参数:self(参数 index 是 0,类型是 id)和 _cmd(参数 index 是 1,类型是 SEL,表示当前方法的 selector)。
第三方同学对此的解释和应用:
1). Filename and Line Number with NSLog: Part I
2). Filename and Line Number with NSLog: Part II
3). Objective-C Expressions for Debugging