logging statements

Table 1  Preprocessor macros and for logging in C/C++/Objective-C.


Format Specifier




Current function signature.



Current line number in the source code file.



Full path to the source code file.



Like __func__, but includes verbose type information in C++ code.

Table 2  Expressions for logging in Objective-C.


Format Specifier




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.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s