Skip to content

Instantly share code, notes, and snippets.

@0xlitf
Last active December 5, 2015 10:54
Show Gist options
  • Save 0xlitf/78a659abba1dba2f3770 to your computer and use it in GitHub Desktop.
Save 0xlitf/78a659abba1dba2f3770 to your computer and use it in GitHub Desktop.
define NSLog
/**
* @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