iOS Log output macros

Source: Internet
Author: User

The following are very common macros and expressions that are useful in log statements.
The preprocessing macro used in the C/c++/objective-c for log output.

Macro Format specifier Description

1. __func__%s before current function

2. Line numbers in __line__%d source files

3. __file__%s source file full path

4. __pretty_function__%s and __func__ are similar, but contain more information in C + + code.

Expressions for log output in Objective-c

Expression Format specifier Description

1. Nsstringfromselector (_cmd)%@//name of the current selector

2. Nsstringfromclass ([self class])%@//Name of the current object class

3. [[NSString stringwithutf8string:__file__] lastpathcomponent]%@//Name of source file

4. [Nsthread Callstacksymbols]%@//array of tick strings for the current stack information. For debugging purposes only, no need to show the end user or make any logic in the code.


iOS Log output macros

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.