1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Log Macros in Objective-C

Last updated at Posted at 2015-03-06
Prefix.pch
#define LOG(...) NSLog(__VA_ARGS__)'
#define LOG_PRINTF(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#define LOG_METHOD NSLog(@"%s", __func__)
#define LOG_METHOD_AND_ABORT LOG_METHOD; abort()

__VA_ARGS__ : Mutable Args
##__VA_ARGS__ : Mutable Args (Except "," when args is nil)
__func__ : Function Name

References
http://tezfm.blogspot.jp/2010/05/objc-vaargs.html
http://www9.plala.or.jp/sgwr-t/c/sec05.html
http://wikiwiki.jp/redstrange/?%C4%EA%B5%C1%BA%D1%A4%DF%A5%DE%A5%AF%A5%ED

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?