Last active
December 5, 2015 10:54
-
-
Save 0xlitf/78a659abba1dba2f3770 to your computer and use it in GitHub Desktop.
define NSLog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @brief 输出格式如下的打印信息:(类名:行数 打印的信息), 只有在DEBUG模式下输出,release模式不会输出(Build Settings 中 Preprocessor Macros 的 Debug 后边会有 DEBUG = 1 定义) | |
| */ | |
| #ifdef DEBUG | |
| #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); | |
| //#define NSLog(FORMAT, ...) fprintf(stderr,"%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); | |
| #else | |
| #define NSLog(...) | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment