日志输出

**Table 1** Preprocessor macros and for logging in C/C++/Objective-C.
Macro Format Specifier Description
__func__ %s Current function signature.
__LINE__ %d Current line number in the source code file.
__FILE__ %s Full path to the source code file.
__PRETTY_FUNCTION__ %s Like __func__, but includes verbose type information in C++ code
Table 2Expressions for logging in Objective-C.
Expression Format Specifier Description
NSStringFromSelector(_cmd) %@ Name of the current selector.
NSStringFromClass([self class]) %@ Name of the current object's class.
[[NSString stringWithUTF8String:__FILE__] lastPathComponent] %@ Name of the source code file.
[NSThread callStackSymbols] %@ NSArray of the current stack trace as programmer-readable strings. For debugging only, do not present it to end users or use to do any logic in your program.

源自:http://developer.apple.com/library/ios/#qa/qa1669/_index.html#//apple_ref/doc/uid/DTS40009343

原文链接: https://www.cnblogs.com/simalone/archive/2011/12/07/2279144.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/38034

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 下午2:41
下一篇 2023年2月8日 下午2:41

相关推荐