Created
June 3, 2012 12:21
-
-
Save mazgi/2863258 to your computer and use it in GitHub Desktop.
デバッグLOG出力
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
#ifdef DEBUG | |
extern void _objc_autoreleasePoolPrint(); | |
#define _objc_autoreleasePoolPrint() _objc_autoreleasePoolPrint() | |
#define __BASENAME__ (strrchr(__FILE__, '/') + 1) | |
/*! | |
@define | |
@abstract デバッグ時のみ出力されるログ | |
@param 第一引数はフォーマット文字列、以降可変引数 | |
*/ | |
#define LOG(...) \ | |
NSLog(@"%s(%s:%05d)%@", __PRETTY_FUNCTION__, __BASENAME__, __LINE__, [NSString stringWithFormat:__VA_ARGS__]) | |
/*! | |
@define | |
@abstract UIViewの全階層を辿り文字列として返す | |
@param view ダンプしたいViewインスタンス | |
@result ダンプ文字列 | |
*/ | |
#define ViewDump(view) \ | |
([view respondsToSelector:@selector(recursiveDescription)])?[view performSelector:@selector(recursiveDescription)]:@"" | |
#else | |
#define _objc_autoreleasePoolPrint() | |
#define LOG(...) | |
#define ViewDump(view) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment